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>
commissionDevice(CommissioningRequest request)
Commission a new device into one or more fabrics.
abstract Task<IntentSender>
shareDevice(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 Matter.ACTION_COMMISSION_DEVICE intent action.
abstract Task<Void>
suppressHalfSheetNotification()
Disables proactive commissionable discovery notifications for Matter devices.

Public Methods

public abstract Task<IntentSender> commissionDevice (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 SettingsClient to launch a deeplink.

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

If this is called when Build.VERSION.SDK_INT is lower than Build.VERSION_CODES.O_MR1, then the Task will fail with an ApiException with the status code CommonStatusCodes.DEVELOPER_ERROR.

public abstract Task<IntentSender> shareDevice (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 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 Build.VERSION.SDK_INT is lower than Build.VERSION_CODES.O_MR1, then the Task will fail with an ApiException with the status code CommonStatusCodes.DEVELOPER_ERROR.

public abstract Task<Void> 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.