Action Required! Starting November 21st, 2022, Nest Hubs opted into the Preview Program are being updated to support Matter 1.0 in anticipation of Google's general availability (GA) of Matter. All Matter devices being used with the Preview Program will need to be updated. See the Release Notes for more details.

CommissioningService

Stay organized with collections Save and categorize content based on your preferences.
public interface CommissioningService

Service implementation for Matter commissioning which facilitates communication between your application and Google Play Services. This CommissioningService must be returned by an exported Service, and that service specified in the CommissioningRequest in order to commission a device into your fabric.

An example implementation may look like:

class MatterCommissioningService : Service(), CommissioningService.Callback {
   private val commissioningServiceDelegate =
     CommissioningService.Builder(this)
       .setCallback(this)
       .build()

   override fun onBind(intent: Intent) = commissioningServiceDelegate.asBinder()

   override fun onCommissioningRequested(metadata: CommissioningRequestMetadata) {
     // perform commissioning

     commissioningServiceDelegate
       .sendCommissioningComplete(CommissioningCompleteMetadata.builder().build())
   }
 }
 

Nested Class Summary

class CommissioningService.Builder A builder to create an implementation of CommissioningService
interface CommissioningService.Callback Callback interface to be notified of requests coming from Google Play Services to your application. 
@interface CommissioningService.CommissioningError Enumeration of valid error code values for CommissioningService.sendCommissioningError(int)  

Public Method Summary

abstract IBinder
asBinder()
Returns the IBinder to return from your service.
abstract Task<Void>
sendCommissioningComplete(CommissioningCompleteMetadata metadata)
Asynchronously sends a response to Google Play Services indicating that you have completed commissioning of a device supplied by CommissioningService.Callback.onCommissioningRequested(CommissioningRequestMetadata)
abstract Task<Void>
sendCommissioningError(int errorCode)
Asynchronously sends a response to Google Play Services indicating that you could not complete commissioning of a device supplied by CommissioningService.Callback.onCommissioningRequested(CommissioningRequestMetadata)

Public Methods

public abstract IBinder asBinder ()

Returns the IBinder to return from your service.

public abstract Task<Void> sendCommissioningComplete (CommissioningCompleteMetadata metadata)

Asynchronously sends a response to Google Play Services indicating that you have completed commissioning of a device supplied by CommissioningService.Callback.onCommissioningRequested(CommissioningRequestMetadata)

Parameters
metadata additional metadata to send to complete the commissioning flow
Returns
  • a task that will be completed when the response has been delivered

public abstract Task<Void> sendCommissioningError (int errorCode)

Asynchronously sends a response to Google Play Services indicating that you could not complete commissioning of a device supplied by CommissioningService.Callback.onCommissioningRequested(CommissioningRequestMetadata)

Parameters
errorCode an error code from CommissioningService.CommissioningError indicating the cause of the failure
Returns
  • a task that will be completed when the response has been delivered