CommissioningClient

interface CommissioningClient : HasApiKey, OptionalModuleApi


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

Summary

Public functions

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

Commission a new device into one or more fabrics.

Task<IntentSender!>!
@RequiresApi(value = VERSION_CODES.O_MR1)
shareDevice(request: 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 ACTION_COMMISSION_DEVICE intent action.

Task<Void!>!

Disables proactive commissionable discovery notifications for Matter devices.

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 com.google.android.gms.home.matter.settings.SettingsClient to launch a deeplink.

In the CommissioningRequest, if a commissioning service is specified via setCommissioningService, 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 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 setOnboardingPayload 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 CommissioningResult in the result data including details about the device which was commissioned. You can unpack the data using fromIntentSenderResult, providing the result code and result data.

If this is called when SDK_INT is lower than O_MR1, then the Task will fail with an with the status code 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 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 SDK_INT is lower than O_MR1, then the Task will fail with an with the status code 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."