# CommissioningRequest.Builder


```
@AutoBuilder
interface CommissioningRequest.Builder
```

<br />

*** ** * ** ***

Builder for constructing a `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest` instance.

## Summary

| ### Public functions |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest!` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#build()()` Builds the request as configured in this builder. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setCommissioningService(android.content.ComponentName)(commissioningService: https://developer.android.com/reference/android/content/ComponentName.html?)` Set the `https://developer.android.com/reference/android/content/ComponentName.html` of an exported service which will return a `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningService` in its `https://developer.android.com/reference/android/app/Service.html#onBind(android.content.Intent)` implementation. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setDeviceAnalyticsEnabled(boolean)(deviceAnalyticsEnabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Sets whether device analytics is enabled. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setDeviceInfo(com.google.android.gms.home.matter.commissioning.DeviceInfo)(deviceInfo: https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/DeviceInfo?)` Sets the information about the target device to be commissioned, if known. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setDeviceNameHint(java.lang.String)(deviceNameHint: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Sets a suggested name for the device, which will be shown to the user after commissioning completes, and the chosen value will be returned in `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningResult`. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setFederatedJwt(java.lang.String)(federatedJwt: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Sets the JSON Web Token (JWT) representing a user account. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setOnboardingPayload(java.lang.String)(onboardingPayload: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Sets the onboarding payload for the target device. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setRoomNameHint(java.lang.String)(roomNameHint: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Sets a suggested room name for the device being commissioned and skips the room picker page. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setShareDeviceFlow(boolean)(shareDeviceFlow: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Sets whether it is in share device flow or not. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setStoreToGoogleFabric(boolean)(storeToGoogleFabric: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Sets whether the device will be commissioned onto the Google fabric. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setStructureId(java.lang.String)(structureId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Sets the `structureId` that should be used for commissioning the device, if known. |

## Public functions

### build

```
fun build(): CommissioningRequest!
```

Builds the request as configured in this builder.

### setCommissioningService

```
@CanIgnoreReturnValue
fun setCommissioningService(commissioningService: ComponentName?): CommissioningRequest.Builder!
```

Set the `https://developer.android.com/reference/android/content/ComponentName.html` of an exported service which will return a `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningService` in its `https://developer.android.com/reference/android/app/Service.html#onBind(android.content.Intent)` implementation.

### setDeviceAnalyticsEnabled

```
@CanIgnoreReturnValue
fun setDeviceAnalyticsEnabled(deviceAnalyticsEnabled: Boolean): CommissioningRequest.Builder!
```

Sets whether device analytics is enabled.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | this builder |

### setDeviceInfo

```
@CanIgnoreReturnValue
fun setDeviceInfo(deviceInfo: DeviceInfo?): CommissioningRequest.Builder!
```

Sets the information about the target device to be commissioned, if known. For example, if you already know the device's vendor/product ID and discriminator, it can be provided here to restrict which device should be set up in the flow.

If not set, then a user can commission any Matter device.

### setDeviceNameHint

```
@CanIgnoreReturnValue
fun setDeviceNameHint(deviceNameHint: String?): CommissioningRequest.Builder!
```

Sets a suggested name for the device, which will be shown to the user after commissioning completes, and the chosen value will be returned in `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningResult`. This can be used in lieu of providing a commissioning service, if only a name suggestion is desired. If both are provided, the callback will still be queried for a name suggestion, but this hint will be used as a fallback if your callback does not return a suggestion.

### setFederatedJwt

```
@CanIgnoreReturnValue
fun setFederatedJwt(federatedJwt: String?): CommissioningRequest.Builder!
```

Sets the JSON Web Token (JWT) representing a user account.

| Parameters |
|---|---|
| `federatedJwt: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | the JSON Web Token (JWT) representing a user account. |

### setOnboardingPayload

```
@CanIgnoreReturnValue
fun setOnboardingPayload(onboardingPayload: String?): CommissioningRequest.Builder!
```

Sets the onboarding payload for the target device. This should be used if you already have established proof of possession, either via a manual pairing code, NFC tag, or QR code scan.

If set, the user will not be required to scan the QR code, NFC tag, or enter a code to initiate commissioning.

Note that the device information in this payload takes precedence over any information provided in `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setDeviceInfo(com.google.android.gms.home.matter.commissioning.DeviceInfo)`.

| Parameters |
|---|---|
| `onboardingPayload: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | the text contents of the payload (e.g. QR code string or manual pairing code) |

### setRoomNameHint

```
@CanIgnoreReturnValue
fun setRoomNameHint(roomNameHint: String?): CommissioningRequest.Builder!
```

Sets a suggested room name for the device being commissioned and skips the room picker page. If the provided room name does not match any of the rooms in the structure, the hint will be ignored.

| Parameters |
|---|---|
| `roomNameHint: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | the suggested room name for the device being commissioned. |

### setShareDeviceFlow

```
@CanIgnoreReturnValue
fun setShareDeviceFlow(shareDeviceFlow: Boolean): CommissioningRequest.Builder!
```

Sets whether it is in share device flow or not.

| Parameters |
|---|---|
| `shareDeviceFlow: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | whether it is in share device flow or not. |

### setStoreToGoogleFabric

```
@CanIgnoreReturnValue
fun setStoreToGoogleFabric(storeToGoogleFabric: Boolean): CommissioningRequest.Builder!
```

Sets whether the device will be commissioned onto the Google fabric.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | this builder |

### setStructureId

```
@CanIgnoreReturnValue
fun setStructureId(structureId: String?): CommissioningRequest.Builder!
```

Sets the `structureId` that should be used for commissioning the device, if known. If specified, and the structure exists for the account that the user selects, then the user will not be asked to select a structure during the commissioning flow.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder!` | this builder |