SharedDeviceData

public final class SharedDeviceData extends Object
implements Parcelable

Class which provides a type-safe interpretation of the Intent that will be delivered when an application is selected from the share-sheet shown via CommissioningClient.shareDevice(ShareDeviceRequest).

The Activity component which is registered for the action:

android:name="com.google.android.gms.home.matter.ACTION_COMMISSION_DEVICE"

will receive an Intent which can be parsed via fromIntent(Intent). If the Intent is missing information (which should not be the case for Intents received from the CommissioningClient APIs), then an SharedDeviceData.InvalidSharedDeviceDataException will be thrown.

Nested Class Summary

class SharedDeviceData.Builder A builder for SharedDeviceData instances. 
class SharedDeviceData.InvalidSharedDeviceDataException Exception thrown when parsing an Intent to retrieved a SharedDeviceData, if the given Intent is missing required data or is malformed. 

Constant Summary

String EXTRA_COMMISSIONING_WINDOW_EXPIRATION Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getCommissioningWindowExpirationMillis() value.
String EXTRA_DEVICE_NAME Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getDeviceName() value.
String EXTRA_DEVICE_TYPE This constant is deprecated. this field is not expected to be populated; the vendor ID and product ID can be used to map to a device type
String EXTRA_MANUAL_PAIRING_CODE Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getManualPairingCode() value.
String EXTRA_PRODUCT_ID Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getProductId() value.
String EXTRA_ROOM_NAME Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getRoomName() value.
String EXTRA_VENDOR_ID Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getVendorId() value.

Inherited Constant Summary

Public Method Summary

static SharedDeviceData.Builder
builder(String manualPairingCode)
Returns a new SharedDeviceData.Builder with the given manualPairingCode set.
boolean
equals(Object other)
static SharedDeviceData
fromIntent(Intent intent)
Returns a SharedDeviceData parsed from the given intent.
long
getCommissioningWindowExpirationMillis()
The expiration time, in milliseconds, of the opened commissioning window.
String
getDeviceName()
Returns the user-specified name of the device being shared, as specified by the app which initiated sharing.
int
getDeviceType()
This method is deprecated. this field is not expected to be populated; the vendor ID and product ID can be used to map to a device type
String
getManualPairingCode()
A manual pairing code encoding the passcode and other information for the shared device.
int
getProductId()
Returns the product ID of the device being shared, as specified by the app which initiated sharing.
String
getRoomName()
Returns the user-facing name of the room in which the device is located, if specified by the app which initiated sharing.
int
getVendorId()
Returns the vendor ID of the device being shared, as specified by the app which initiated sharing.
int
Intent
toIntent()
Converts this SharedDeviceData instance into an Intent that can be parsed into an equivalent instance as fromIntent(Intent).
String
void
writeToParcel(Parcel dest, int flags)

Inherited Method Summary

Constants

public static final String EXTRA_COMMISSIONING_WINDOW_EXPIRATION

Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getCommissioningWindowExpirationMillis() value.

Intent extra type: Long

Constant Value: "com.google.android.gms.home.matter.EXTRA_COMMISSIONING_WINDOW_EXPIRATION"

public static final String EXTRA_DEVICE_NAME

Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getDeviceName() value.

Intent extra type: String

Constant Value: "com.google.android.gms.home.matter.EXTRA_DEVICE_NAME"

public static final String EXTRA_DEVICE_TYPE

This constant is deprecated.
this field is not expected to be populated; the vendor ID and product ID can be used to map to a device type

Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getDeviceType() value.

Intent extra type: Integer

Constant Value: "com.google.android.gms.home.matter.EXTRA_DEVICE_TYPE"

public static final String EXTRA_MANUAL_PAIRING_CODE

Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getManualPairingCode() value.

Intent extra type: String.

Constant Value: "com.google.android.gms.home.matter.EXTRA_MANUAL_PAIRING_CODE"

public static final String EXTRA_PRODUCT_ID

Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getProductId() value.

Intent extra type: Integer

Constant Value: "com.google.android.gms.home.matter.EXTRA_PRODUCT_ID"

public static final String EXTRA_ROOM_NAME

Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getRoomName() value.

Intent extra type: String

Constant Value: "com.google.android.gms.home.matter.EXTRA_ROOM_NAME"

public static final String EXTRA_VENDOR_ID

Intent extra key for the result of CommissioningClient.shareDevice(ShareDeviceRequest) to retrieve the getVendorId() value.

Intent extra type: Integer

Constant Value: "com.google.android.gms.home.matter.EXTRA_VENDOR_ID"

Public Methods

public static SharedDeviceData.Builder builder (String manualPairingCode)

Returns a new SharedDeviceData.Builder with the given manualPairingCode set.

public boolean equals (Object other)

public static SharedDeviceData fromIntent (Intent intent)

Returns a SharedDeviceData parsed from the given intent.

Parameters
intent the intent data returned as a result from an IntentSender started for result from the CommissioningClient.shareDevice(ShareDeviceRequest) API
Throws
SharedDeviceData.InvalidSharedDeviceDataException if intent was malformed or missing required data

public long getCommissioningWindowExpirationMillis ()

The expiration time, in milliseconds, of the opened commissioning window. The time basis is SystemClock.elapsedRealtime(), and not System.currentTimeMillis().

public String getDeviceName ()

Returns the user-specified name of the device being shared, as specified by the app which initiated sharing.

public int getDeviceType ()

This method is deprecated.
this field is not expected to be populated; the vendor ID and product ID can be used to map to a device type

Returns the primary device type of the device being shared, as specified by the app which initiated sharing. If not specified, this returns zero.

public String getManualPairingCode ()

A manual pairing code encoding the passcode and other information for the shared device.

public int getProductId ()

Returns the product ID of the device being shared, as specified by the app which initiated sharing.

public String getRoomName ()

Returns the user-facing name of the room in which the device is located, if specified by the app which initiated sharing.

public int getVendorId ()

Returns the vendor ID of the device being shared, as specified by the app which initiated sharing.

public int hashCode ()

public Intent toIntent ()

Converts this SharedDeviceData instance into an Intent that can be parsed into an equivalent instance as fromIntent(Intent).

public String toString ()

public void writeToParcel (Parcel dest, int flags)