# CommissioningClient

public interface **CommissioningClient** implements HasApiKey\<Api.ApiOptions.NoOptions\> OptionalModuleApi Performs commissioning of Matter devices (both initial out of box commissioning, as well
as multi-administrator commissioning flows).

### Public Method Summary

|---|---|
| abstract Task\<[IntentSender](https://developer.android.com/reference/android/content/IntentSender.html)\> | [commissionDevice](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/commissioning/CommissioningClient#commissionDevice(com.google.android.gms.home.matter.commissioning.CommissioningRequest))([CommissioningRequest](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/commissioning/CommissioningRequest) request) Commission a new device into one or more fabrics. |
| abstract Task\<[IntentSender](https://developer.android.com/reference/android/content/IntentSender.html)\> | [shareDevice](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/commissioning/CommissioningClient#shareDevice(com.google.android.gms.home.matter.commissioning.ShareDeviceRequest))([ShareDeviceRequest](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/commissioning/ShareDeviceRequest) request) 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/android/reference/com/google/android/gms/home/matter/Matter#ACTION_COMMISSION_DEVICE` intent action. |
| abstract Task\<[Void](https://developer.android.com/reference/java/lang/Void.html)\> | [suppressHalfSheetNotification](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/commissioning/CommissioningClient#suppressHalfSheetNotification())() Disables proactive commissionable discovery notifications for Matter devices. |

## Public Methods

#### public abstract Task\<[IntentSender](https://developer.android.com/reference/android/content/IntentSender.html)\>
**commissionDevice** ([CommissioningRequest](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/commissioning/CommissioningRequest) request)

Commission a new device into one or more fabrics. By default, the device will be
commissioned into an Android fabric scoped to this phone or tablet. Devices inserted
into this fabric can be managed from settings, using `https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/settings/SettingsClient`
to launch a deeplink.

In the `https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/commissioning/CommissioningRequest`, if a commissioning service is specified via
`https://developers.home.google.com/android/reference/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/android/reference/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/android/reference/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/android/reference/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/android/reference/com/google/android/gms/home/matter/commissioning/CommissioningResult#fromIntentSenderResult(int,%20android.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.home.google.com/android/reference/com/google/android/gms/tasks/Task` will fail
with an `https://developers.home.google.com/android/reference/com/google/android/gms/common/api/ApiException`
with the status code `https://developers.home.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes#DEVELOPER_ERROR`.

#### public abstract Task\<[IntentSender](https://developer.android.com/reference/android/content/IntentSender.html)\>
**shareDevice** ([ShareDeviceRequest](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/commissioning/ShareDeviceRequest) request)

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/android/reference/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.home.google.com/android/reference/com/google/android/gms/tasks/Task` will fail
with an `https://developers.home.google.com/android/reference/com/google/android/gms/common/api/ApiException`
with the status code `https://developers.home.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes#DEVELOPER_ERROR`.

#### public abstract Task\<[Void](https://developer.android.com/reference/java/lang/Void.html)\> **suppressHalfSheetNotification** ()

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.