class ComplicationRequest


Data associated with complication request in ComplicationDataSourceService.onComplicationRequest.

Summary

Public constructors

ComplicationRequest(
    complicationInstanceId: Int,
    complicationType: ComplicationType
)

This function is deprecated. Use a constructor that specifies responseNeededSoon.

ComplicationRequest(
    complicationInstanceId: Int,
    complicationType: ComplicationType,
    immediateResponseRequired: Boolean
)

Constructs a ComplicationRequest without setting isForSafeWatchFace.

@RequiresApi(value = 33)
ComplicationRequest(
    complicationInstanceId: Int,
    complicationType: ComplicationType,
    immediateResponseRequired: Boolean,
    isForSafeWatchFace: Int
)

Public properties

Int

The system's id for the requested complication which is a unique value for the tuple Watch face ComponentName, complication slot ID.

ComplicationType

The ComplicationType of complication data requested.

Boolean

If true then ComplicationRequestListener.onComplicationData should be called as soon as possible (ideally less than 100ms instead of the usual 20s deadline).

Int

Intended for OEM use, returns whether this request is on behalf of a 'safe' watch face as defined by the ComplicationDataSourceService.METADATA_KEY_SAFE_WATCH_FACES meta data in the data source's manifest.

Public constructors

ComplicationRequest

Added in 1.0.0
Deprecated in 1.1.0
ComplicationRequest(
    complicationInstanceId: Int,
    complicationType: ComplicationType
)

ComplicationRequest

Added in 1.1.0
ComplicationRequest(
    complicationInstanceId: Int,
    complicationType: ComplicationType,
    immediateResponseRequired: Boolean
)

Constructs a ComplicationRequest without setting isForSafeWatchFace.

ComplicationRequest

Added in 1.2.0
@RequiresApi(value = 33)
ComplicationRequest(
    complicationInstanceId: Int,
    complicationType: ComplicationType,
    immediateResponseRequired: Boolean,
    isForSafeWatchFace: Int
)
Parameters
complicationInstanceId: Int

The system's id for the requested complication which is a unique value for the tuple Watch face ComponentName, complication slot ID.

complicationType: ComplicationType

The type of complication data requested.

immediateResponseRequired: Boolean

If true then ComplicationRequestListener.onComplicationData should be called as soon as possible (ideally less than 100ms instead of the usual 20s deadline). This will only be true within a ComplicationDataSourceService.onStartImmediateComplicationRequests pair.

isForSafeWatchFace: Int

Whether this request is on behalf of a 'safe' watch face as defined by the ComplicationDataSourceService.METADATA_KEY_SAFE_WATCH_FACES meta data in the data source's manifest. The data source may choose to serve different results for a 'safe' watch face. If the data source does not have the privileged permission com.google.wear.permission.GET_IS_FOR_SAFE_WATCH_FACE, then this must be null.

Public properties

complicationInstanceId

Added in 1.0.0
val complicationInstanceIdInt

The system's id for the requested complication which is a unique value for the tuple Watch face ComponentName, complication slot ID.

complicationType

Added in 1.0.0
val complicationTypeComplicationType

The ComplicationType of complication data requested.

immediateResponseRequired

Added in 1.1.0
val immediateResponseRequiredBoolean

If true then ComplicationRequestListener.onComplicationData should be called as soon as possible (ideally less than 100ms instead of the usual 20s deadline). This will only be true within a ComplicationDataSourceService.onStartImmediateComplicationRequests pair which will not be called unless the ComplicationDataSourceService has privileged permission com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE.

isForSafeWatchFace

Added in 1.2.0
@RequiresApi(value = 33)
val isForSafeWatchFaceInt

Intended for OEM use, returns whether this request is on behalf of a 'safe' watch face as defined by the ComplicationDataSourceService.METADATA_KEY_SAFE_WATCH_FACES meta data in the data source's manifest. The data source may choose to serve different results for a 'safe' watch face.

If the ComplicationDataSourceService.METADATA_KEY_SAFE_WATCH_FACES meta data is not defined then this will be TargetWatchFaceSafety.UNKNOWN.

Note if the ComplicationDataSourceService does not have the privileged permission com.google.wear.permission.GET_IS_FOR_SAFE_WATCH_FACE, then this will be TargetWatchFaceSafety.UNKNOWN.