# CommissioningClient


```
interface CommissioningClient : HasApiKey, OptionalModuleApi
```

<br />

*** ** * ** ***

Performs commissioning of Matter devices (both initial out of box commissioning, as well as multi-administrator commissioning flows).

## Summary

| ### Public functions |
|---|---|
| `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html<https://developer.android.com/reference/android/content/IntentSender.html!>!` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi.html(value = https://developer.android.com/reference/android/os/VERSION_CODES.html#O_MR1) https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningClient#commissionDevice(com.google.android.gms.home.matter.commissioning.CommissioningRequest)(request: https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest!)` Commission a new device into one or more fabrics. |
| `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html<https://developer.android.com/reference/android/content/IntentSender.html!>!` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi.html(value = https://developer.android.com/reference/android/os/VERSION_CODES.html#O_MR1) https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningClient#shareDevice(com.google.android.gms.home.matter.commissioning.ShareDeviceRequest)(request: https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/ShareDeviceRequest!)` Returns an IntentSender which can be used to display a sharing UI, which allows the user to grant administrative control of a Matter device to another user (via text) or application via Intent sharing to applications registered to receive the `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/Matter#ACTION_COMMISSION_DEVICE()` intent action. |
| `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html<https://developer.android.com/reference/java/lang/Void.html!>!` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningClient#suppressHalfSheetNotification()()` Disables proactive commissionable discovery notifications for Matter devices. |

### Inherited functions

From [com.google.android.gms.common.api.HasApiKey](https://developers.google.com/android/reference/com/google/android/gms/common/api/HasApiKey.html) `https://developers.home.google.com/reference/kotlin/com/google/android/gms/common/api/internal/ApiKey<O!>!` `https://developers.google.com/android/reference/com/google/android/gms/common/api/HasApiKey.html#getApiKey--()` From [com.google.android.gms.common.api.OptionalModuleApi](https://developers.google.com/android/reference/com/google/android/gms/common/api/OptionalModuleApi.html) `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://developers.google.com/android/reference/com/google/android/gms/common/Feature.html!>!` `https://developers.google.com/android/reference/com/google/android/gms/common/api/OptionalModuleApi.html#getOptionalFeatures--()`

## Public functions

### commissionDevice

```
@RequiresApi(value = VERSION_CODES.O_MR1)
fun commissionDevice(request: CommissioningRequest!): Task<IntentSender!>!
```

Commission a new device into one or more fabrics. Devices commissioned using this API can later be managed from settings, using `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/settings/SettingsClient` to launch a deeplink.

In the `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest`, if a commissioning service is specified via `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setCommissioningService(android.content.ComponentName)`, then this service will be bound and a commissioning request will be dispatched to this service after the device has been initially onboarded onto an operational network.

If you already know the particular device that you are looking for, then you can specify this via the `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/DeviceInfo` in the request to provide a hint as to which device will be set up during this commissioning process.

Alternatively, if you already have an onboarding payload for a device (i.e. a manual pairing code, or QR code string) you can specify this in the request via `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningRequest.Builder#setOnboardingPayload(java.lang.String)` to target a specific device, and bypass the need to scan a QR code or enter a manual pairing code during commissioning. Note that this API can be used either to perform initial onboarding of a device (including operational network configuration) as well as multi-admin commissioning for shared devices.

Upon success, the activity result will contain a `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningResult` in the result data including details about the device which was commissioned. You can unpack the data using `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/CommissioningResult#fromIntentSenderResult(int,android.content.Intent)`, providing the result code and result data.

If this is called when `https://developer.android.com/reference/android/os/Build.VERSION.html#SDK_INT` is lower than `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O_MR1`, then the `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html` will fail with an `https://developers.google.com/android/reference/com/google/android/gms/common/api/ApiException.html` with the status code `https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes.html#DEVELOPER_ERROR`.

### shareDevice

```
@RequiresApi(value = VERSION_CODES.O_MR1)
fun shareDevice(request: ShareDeviceRequest!): Task<IntentSender!>!
```

Returns an IntentSender which can be used to display a sharing UI, which allows the user to grant administrative control of a Matter device to another user (via text) or application via Intent sharing to applications registered to receive the `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/Matter#ACTION_COMMISSION_DEVICE()` intent action.

Upon receiving an IntentSender, it should be started for result. At this point, it is expected that the shared device already has an opened commissioning window, the details of which must be provided in the request.

If the user chooses a sharing destination, then the result will be RESULT_OK, and no further action should be taken (note that this does not mean that the user has commissioned the device -- only that the information has been sent elsewhere). Upon receiving a result of RESULT_CANCELED, it is recommended that you then revoke the opened commissioning window on the device.

If this is called when `https://developer.android.com/reference/android/os/Build.VERSION.html#SDK_INT` is lower than `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O_MR1`, then the `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html` will fail with an `https://developers.google.com/android/reference/com/google/android/gms/common/api/ApiException.html` with the status code `https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes.html#DEVELOPER_ERROR`.

### suppressHalfSheetNotification

```
fun suppressHalfSheetNotification(): Task<Void!>!
```

Disables proactive commissionable discovery notifications for Matter devices. If your application provides its own Matter discovery or commissioning flow, you may wish to suppress these notifications to prevent interruptions.

Notifications may be suppressed only while your application is in the foreground. Upon leaving the foreground, notifications will automatically be re-enabled.

Given this requirement, it is recommended that you disable notifications in your application process onStart() lifecycle method.

The suppression of the half sheet will be active for bounded time period. The default timeout 15 minutes."