ComplicationDataSourceService


abstract class ComplicationDataSourceService : Service


Class for sources of complication data.

A complication data source service must implement onComplicationRequest to respond to requests for updates from the complication system.

Manifest requirements:

  • The manifest declaration of this service must include an intent filter for android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST.

  • A ComplicationDataSourceService must include a meta-data tag with android.support.wearable.complications.SUPPORTED_TYPES in its manifest entry.

The value of android.support.wearable.complications.SUPPORTED_TYPES should be a comma separated list of types supported by the data source, from this table:

Androidx class Tag name
GoalProgressComplicationData GOAL_PROGRESS
LongTextComplicationData LONG_TEXT
MonochromaticImageComplicationData ICON
PhotoImageComplicationData LARGE_IMAGE
RangedValueComplicationData RANGED_TEXT
ShortTextComplicationData SHORT_TEXT
SmallImageComplicationData SMALL_IMAGE
WeightedElementsComplicationData WEIGHTED_ELEMENTS

The order in which types are listed has no significance. In the case where a watch face supports multiple types in a single complication slot, the watch face will determine which types it prefers.

For example, a complication data source that supports the RANGED_VALUE, SHORT_TEXT, and ICON types would include the following in its manifest entry:

<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="RANGED_VALUE,SHORT_TEXT,ICON" />

From android T onwards, it is recommended for ComplicationDataSourceServices to be direct boot aware because the system is able to fetch complications before the lock screen has been removed. To do this add android:directBootAware="true" to your service tag.

  • A provider can choose to trust one or more watch faces by including the following in its manifest entry:

<meta-data
android:name="android.support.wearable.complications.SAFE_WATCH_FACES"
android:value="com.pkg1/com.trusted.wf1,com.pkg2/com.trusted.wf2" />

The listed watch faces will not need com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA in order to receive complications from this provider. Also the provider may choose to serve different types to safe watch faces by including the following in its manifest:

<meta-data
android:name="androidx.wear.watchface.complications.datasource.SAFE_WATCH_FACE_SUPPORTED_TYPES"
android:value="ICON" />

In addition the provider can learn if a request is for a safe watchface by examining ComplicationRequest.isForSafeWatchFace. Note SAFE_WATCH_FACE_SUPPORTED_TYPES and isForSafeWatchFace are gated behind the privileged permission com.google.wear.permission.GET_IS_FOR_SAFE_WATCH_FACE.

  • A ComplicationDataSourceService should include a meta-data tag with android.support.wearable.complications.UPDATE_PERIOD_SECONDS in its manifest entry. The value of this tag is the number of seconds the complication data source would like to elapse between update requests.

Note that update requests are not guaranteed to be sent with this frequency. For complications with frequent updates they can also register a separate meta-data tag with androidx.wear.watchface.complications.data.source.IMMEDIATE_UPDATE_PERIOD_MILLISECONDS in their manifest which supports sampling at up to 1Hz when the watch face is visible and non-ambient, however this also requires the application to have the privileged permission com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE.

If a complication data source never needs to receive update requests beyond the one sent when a complication is activated, the value of this tag should be 0.

For example, a complication data source that would like to update at most every hour should include the following in its manifest entry:

<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="3600" />
  • A ComplicationDataSourceService can include a meta-data tag with android.support.wearable.complications.PROVIDER_CONFIG_ACTION its manifest entry to cause a configuration activity to be shown when the complication data source is selected.

The configuration activity must reside in the same package as the complication data source, and must register an intent filter for the action specified here, including android.support.wearable.complications.category.PROVIDER_CONFIG as well as Intent.CATEGORY_DEFAULT as categories.

Note back up and restore of any configuration data is left to the complication data source, see METADATA_KEY_CONFIG_RESTORE_SUPPORTED for more details.

The complication id being configured will be included in the intent that starts the config activity using the extra key android.support.wearable.complications.EXTRA_CONFIG_COMPLICATION_ID.

The complication type that will be requested from the complication data source will also be included, using the extra key android.support.wearable.complications.EXTRA_CONFIG_COMPLICATION_TYPE.

The complication data source's ComponentName will also be included in the intent that starts the config activity, using the extra key android.support.wearable.complications.EXTRA_CONFIG_PROVIDER_COMPONENT.

The config activity must call Activity.setResult with either Activity.RESULT_OK or Activity.RESULT_CANCELED before it is finished, to tell the system whether or not the complication data source should be set on the given complication.

It is possible to provide additional meta-data tag androidx.watchface.complications.datasource.DEFAULT_CONFIG_SUPPORTED in the service set to "true" to let the system know that the data source is able to provide complication data before it is configured.

  • The manifest entry for the service should also include an android:icon attribute. The icon provided there should be a single-color white icon that represents the complication data source. This icon will be shown in the complication data source chooser interface, and may also be included in ComplicationProviderInfo given to watch faces for display in their configuration activities.

  • The manifest entry should also include android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER" to ensure that only the system can bind to it.

Multiple complication data sources in the same APK are supported but in android R there's a soft limit of 100 data sources per APK. Above that the companion watchface editor won't support this complication data source app.

There's no need to call setDataSource for any the ComplicationData Builders because the system will append this value on your behalf.

Summary

Constants

const String

The intent action used to send update requests to the data source.

const String

Category for complication data source config activities.

const String

Extra used to supply the complication id to a complication data source configuration activity.

const String

Extra used to supply the complication type to a complication data source configuration activity.

const String

Extra used to supply the complication data source component to a complication data source configuration activity.

const String

Metadata key used to declare that the complication data source service supports backup and restore (B&R) of complication configuration data.

const String

Metadata key used to declare an action for a configuration activity for a complication data source.

const String

Metadata key.

const String

Metadata key used to request elevated frequency of onComplicationRequests when the watch face is visible and non-ambient.

const String

Metadata key used to declare a list of watch faces that may receive data from a complication data source before they are granted the RECEIVE_COMPLICATION_DATA permission.

const String

Metadata key used to declare supported complication types for safe watch faces.

const String

Metadata key used to declare supported complication types.

const String

Metadata key used to declare the requested frequency of update requests.

Public constructors

Public functions

abstract ComplicationData?

A request for representative preview data for the complication, for use in the editor UI.

final IBinder?
onBind(intent: Intent)
open Unit
@MainThread
onComplicationActivated(
    complicationInstanceId: Int,
    type: ComplicationType
)

Called when a complication is activated.

open Unit
@MainThread
onComplicationDeactivated(complicationInstanceId: Int)

Called when a complication is deactivated.

abstract Unit

Called when a complication data update is requested for the given complication id.

open Unit

If a metadata key with METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS is present in the manifest, and the provider has privileged permission com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE, then onStartImmediateComplicationRequests will be called when the watch face is visible and non-ambient.

open Unit

If a metadata key with METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS is present in the manifest, and the provider has privileged permission com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE, then onStartImmediateComplicationRequests will be called when the watch face ceases to be visible and non-ambient.

Inherited functions

From android.content.Context
From android.content.ContextWrapper
open Boolean
bindIsolatedService(
    p0: Intent,
    p1: Int,
    p2: String,
    p3: Executor,
    p4: ServiceConnection
)
open Boolean
bindService(
    p0: Intent,
    p1: ServiceConnection,
    p2: Context.BindServiceFlags
)
open Boolean
open Boolean
bindService(
    p0: Intent,
    p1: Context.BindServiceFlags,
    p2: Executor,
    p3: ServiceConnection
)
open Boolean
bindService(p0: Intent, p1: Int, p2: Executor, p3: ServiceConnection)
open Boolean
bindServiceAsUser(
    p0: Intent,
    p1: ServiceConnection,
    p2: Context.BindServiceFlags,
    p3: UserHandle
)
open Boolean
open Int
open Int
open IntArray
open Int
open Int
open IntArray
open Int
checkPermission(p0: String, p1: Int, p2: Int)
open Int
open Int
checkUriPermission(p0: Uri, p1: Int, p2: Int, p3: Int)
open Int
checkUriPermission(p0: Uri?, p1: String?, p2: String?, p3: Int, p4: Int, p5: Int)
open IntArray
checkUriPermissions(p0: MutableList<Uri>, p1: Int, p2: Int, p3: Int)
open Unit

This function is deprecated. Deprecated in Java

open Context
open Context
open Context
open Context
open Context
open Context
open Context
open Context
open Context
open Context
createWindowContext(p0: Display, p1: Int, p2: Bundle?)
open Array<String>
open Boolean
open Boolean
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
enforcePermission(p0: String, p1: Int, p2: Int, p3: String?)
open Unit
enforceUriPermission(p0: Uri, p1: Int, p2: Int, p3: Int, p4: String)
open Unit
enforceUriPermission(
    p0: Uri?,
    p1: String?,
    p2: String?,
    p3: Int,
    p4: Int,
    p5: Int,
    p6: String?
)
open Array<String>
open Context
open ApplicationInfo
open AssetManager
open AttributionSource
open String?
open Context
open File
open ClassLoader
open File
open ContentResolver
open File
open File
open Int
open File
getDir(p0: String, p1: Int)
open Display?
open File?
open Array<File>
open File?
open Array<File>
open Array<File>
open File
open File
open Executor
open Looper
open File
open File
open Array<File>
open String
open String
open PackageManager
open String
open String
open ContextParams?
open Resources
open SharedPreferences
open Any
open String?
open Resources.Theme
open Drawable

This function is deprecated. Deprecated in Java

open Int

This function is deprecated. Deprecated in Java

open Int

This function is deprecated. Deprecated in Java

open Unit
grantUriPermission(p0: String, p1: Uri, p2: Int)
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open FileInputStream
open FileOutputStream
open SQLiteDatabase
open SQLiteDatabase
openOrCreateDatabase(
    p0: String,
    p1: Int,
    p2: SQLiteDatabase.CursorFactory,
    p3: DatabaseErrorHandler?
)
open Drawable

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Intent?
open Intent?
open Intent?
registerReceiver(
    p0: BroadcastReceiver?,
    p1: IntentFilter,
    p2: String?,
    p3: Handler?
)
open Intent?
registerReceiver(
    p0: BroadcastReceiver?,
    p1: IntentFilter,
    p2: String?,
    p3: Handler?,
    p4: Int
)
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
revokeUriPermission(p0: String, p1: Uri, p2: Int)
open Unit
open Unit
open Unit
sendBroadcast(p0: Intent, p1: String?, p2: Bundle?)
open Unit
open Unit
open Unit
open Unit
open Unit
sendOrderedBroadcast(
    p0: Intent,
    p1: String?,
    p2: BroadcastReceiver?,
    p3: Handler?,
    p4: Int,
    p5: String?,
    p6: Bundle?
)
open Unit
sendOrderedBroadcast(
    p0: Intent,
    p1: String?,
    p2: Bundle?,
    p3: BroadcastReceiver?,
    p4: Handler?,
    p5: Int,
    p6: String?,
    p7: Bundle?
)
open Unit
sendOrderedBroadcast(
    p0: Intent,
    p1: String?,
    p2: String?,
    p3: BroadcastReceiver?,
    p4: Handler?,
    p5: Int,
    p6: String?,
    p7: Bundle?
)
open Unit
sendOrderedBroadcast(
    p0: Intent,
    p1: Int,
    p2: String?,
    p3: String?,
    p4: BroadcastReceiver?,
    p5: Handler?,
    p6: String?,
    p7: Bundle?,
    p8: Bundle?
)
open Unit
sendOrderedBroadcastAsUser(
    p0: Intent,
    p1: UserHandle,
    p2: String?,
    p3: BroadcastReceiver?,
    p4: Handler?,
    p5: Int,
    p6: String?,
    p7: Bundle?
)
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
sendStickyOrderedBroadcast(
    p0: Intent,
    p1: BroadcastReceiver?,
    p2: Handler?,
    p3: Int,
    p4: String?,
    p5: Bundle?
)

This function is deprecated. Deprecated in Java

open Unit
sendStickyOrderedBroadcastAsUser(
    p0: Intent,
    p1: UserHandle,
    p2: BroadcastReceiver?,
    p3: Handler?,
    p4: Int,
    p5: String?,
    p6: Bundle?
)

This function is deprecated. Deprecated in Java

open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
open ComponentName?
open Boolean
open Unit
startIntentSender(p0: IntentSender, p1: Intent?, p2: Int, p3: Int, p4: Int)
open Unit
startIntentSender(
    p0: IntentSender,
    p1: Intent?,
    p2: Int,
    p3: Int,
    p4: Int,
    p5: Bundle?
)
open ComponentName?
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
From android.app.Service
open Unit
open Unit
Application
Int
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
onStart(p0: Intent, p1: Int)

This function is deprecated. Deprecated in Java

open Int
onStartCommand(p0: Intent, p1: Int, p2: Int)
open Unit
open Unit
open Unit
open Boolean
Unit
Unit
startForeground(p0: Int, p1: Notification, p2: Int)
Unit

This function is deprecated. Deprecated in Java

Unit
Unit
Unit
Boolean

Constants

ACTION_COMPLICATION_UPDATE_REQUEST

const val ACTION_COMPLICATION_UPDATE_REQUESTString

The intent action used to send update requests to the data source. ComplicationDataSourceService must declare an intent filter for this action in the manifest.

CATEGORY_DATA_SOURCE_CONFIG

const val CATEGORY_DATA_SOURCE_CONFIGString

Category for complication data source config activities. The configuration activity for a complication complication data source must specify this category in its intent filter.

EXTRA_CONFIG_COMPLICATION_ID

const val EXTRA_CONFIG_COMPLICATION_IDString

Extra used to supply the complication id to a complication data source configuration activity.

EXTRA_CONFIG_COMPLICATION_TYPE

const val EXTRA_CONFIG_COMPLICATION_TYPEString

Extra used to supply the complication type to a complication data source configuration activity.

EXTRA_CONFIG_DATA_SOURCE_COMPONENT

const val EXTRA_CONFIG_DATA_SOURCE_COMPONENTString

Extra used to supply the complication data source component to a complication data source configuration activity.

METADATA_KEY_CONFIG_RESTORE_SUPPORTED

@RequiresApi(value = 34)
const val METADATA_KEY_CONFIG_RESTORE_SUPPORTEDString

Metadata key used to declare that the complication data source service supports backup and restore (B&R) of complication configuration data. The system is responsible for backup and restore of the assignment of complications to watch faces, but responsibility for backup and restore for any complication data source configuration data is left to the data source.

If this flag is set to false, then the system will restore any complications using this provider in the "not configured" state, i.e. the complication will show a + sign with a tap action leading to the complication data source's configuration action as defined by METADATA_KEY_DATA_SOURCE_CONFIG_ACTION, instead of real data.

This is a boolean value, defaulting to true, which means apps are opted in by default but can explicitly opt out by setting this meta-data tag to false.

The value is ignored (equivalent to false) if the app does not enable Android B&R ( https://developer.android.com/guide/topics/data/backup). This value is also ignored prior to Android U.

METADATA_KEY_DATA_SOURCE_CONFIG_ACTION

const val METADATA_KEY_DATA_SOURCE_CONFIG_ACTIONString

Metadata key used to declare an action for a configuration activity for a complication data source.

A ComplicationDataSourceService can include a meta-data tag with this name in its manifest entry to cause a configuration activity to be shown when the complication data source is selected.

The configuration activity must reside in the same package as the complication data source, and must register an intent filter for the action specified here, including CATEGORY_DATA_SOURCE_CONFIG as well as Intent.CATEGORY_DEFAULT as categories.

The complication id being configured will be included in the intent that starts the config activity using the extra key EXTRA_CONFIG_COMPLICATION_ID.

The complication type that will be requested from the complication data source will also be included, using the extra key EXTRA_CONFIG_COMPLICATION_TYPE.

The complication data source's ComponentName will also be included in the intent that starts the config activity, using the extra key EXTRA_CONFIG_DATA_SOURCE_COMPONENT.

The config activity must call Activity.setResult with either Activity.RESULT_OK or Activity.RESULT_CANCELED before it is finished, to tell the system whether or not the complication data source should be set on the given complication.

METADATA_KEY_DATA_SOURCE_DEFAULT_CONFIG_SUPPORTED

const val METADATA_KEY_DATA_SOURCE_DEFAULT_CONFIG_SUPPORTEDString

Metadata key. Setting to "true" indicates to the system that this complication data source with a PROVIDER_CONFIG_ACTION metadata tag is able to provide complication data before it is configured. See METADATA_KEY_DATA_SOURCE_CONFIG_ACTION.

METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS

const val METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDSString

Metadata key used to request elevated frequency of onComplicationRequests when the watch face is visible and non-ambient.

To do this ComplicationDataSourceService should include a meta-data tag with this name in its manifest entry. The value of this tag is the number of milliseconds the complication data source would like to elapse between onComplicationRequests requests when the watch face is visible and non-ambient.

Note in addition to this meta-data, the data source must also request the privileged permission com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE.

Note that update requests are not guaranteed to be sent with this frequency and a lower limit exists (initially 1 second).

METADATA_KEY_SAFE_WATCH_FACES

const val METADATA_KEY_SAFE_WATCH_FACESString

Metadata key used to declare a list of watch faces that may receive data from a complication data source before they are granted the RECEIVE_COMPLICATION_DATA permission. This allows the listed watch faces to set the complication data source as a default and have the complication populate when the watch face is first seen.

Only trusted watch faces that will set this complication data source as a default should be included in this list.

Note that if a watch face is in the same app package as the complication data source, it does not need to be added to this list.

The value of this tag should be a comma separated list of watch faces or packages. An entry can be a flattened component, as if ComponentName.flattenToString had been called, to declare a specific watch face as safe. An entry can also be a package name, as if ComponentName.getPackageName had been called, in which case any watch face under the app with that package name will be considered safe for this complication data source.

From Android T, if this provider has the privileged permission com.google.wear.permission.GET_IS_FOR_SAFE_WATCH_FACE, then ComplicationRequest.isForSafeWatchFace will be populated.

METADATA_KEY_SAFE_WATCH_FACE_SUPPORTED_TYPES

const val METADATA_KEY_SAFE_WATCH_FACE_SUPPORTED_TYPESString

Metadata key used to declare supported complication types for safe watch faces.

Gated behind the privileged permission `com.google.wear.permission.GET_IS_FOR_SAFE_WATCH_FACE', this overrides the METADATA_KEY_SUPPORTED_TYPES list for 'safe' watch faces. I.e. watch faces in the METADATA_KEY_SAFE_WATCH_FACES metadata list.

This means for example trusted watch faces could receive ComplicationType.SHORT_TEXT and untrusted ones ComplicationType.MONOCHROMATIC_IMAGE.

METADATA_KEY_SUPPORTED_TYPES

const val METADATA_KEY_SUPPORTED_TYPESString

Metadata key used to declare supported complication types.

A ComplicationDataSourceService must include a meta-data tag with this name in its manifest entry. The value of this tag should be a comma separated list of types supported by the complication data source. Types should be given as named as per the type fields in the ComplicationData, but omitting the "TYPE_" prefix, e.g. SHORT_TEXT, LONG_TEXT, RANGED_VALUE.

The order of types in METADATA_KEY_SUPPORTED_TYPES has no significance. During complication data source selection, each item in the complication slot's supported types is checked against entries in the data source's METADATA_KEY_SUPPORTED_TYPES and the first matching entry from the slot's support types (if any) is chosen. If there are no matches then this data source is not eligible to be selected in that slot.

For example, a complication data source that supports the RANGED_VALUE, SHORT_TEXT, and ICON type would include the following in its manifest entry:

<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="RANGED_VALUE,SHORT_TEXT,ICON" />

METADATA_KEY_UPDATE_PERIOD_SECONDS

const val METADATA_KEY_UPDATE_PERIOD_SECONDSString

Metadata key used to declare the requested frequency of update requests.

A ComplicationDataSourceService should include a meta-data tag with this name in its manifest entry. The value of this tag is the number of seconds the complication data source would like to elapse between update requests.

Note that update requests are not guaranteed to be sent with this frequency.

If a complication data source never needs to receive update requests beyond the one sent when a complication is activated, the value of this tag should be 0.

For example, a complication data source that would like to update every ten minutes should include the following in its manifest entry:

<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="600" />

Public constructors

ComplicationDataSourceService

Added in 1.0.0
ComplicationDataSourceService()

Public functions

getPreviewData

Added in 1.0.0
abstract fun getPreviewData(type: ComplicationType): ComplicationData?

A request for representative preview data for the complication, for use in the editor UI. Preview data is assumed to be static per type. E.g. for a complication that displays the date and time of an event, rather than returning the real time it should return a fixed date and time such as 10:10 Aug 1st. This data may be cached by the system and the result should be constant based on the current locale.

This will be called on a background thread.

Parameters
type: ComplicationType

The type of complication preview data requested.

Returns
ComplicationData?

Preview data for the given complication type.

onBind

Added in 1.0.0
final fun onBind(intent: Intent): IBinder?

onComplicationActivated

Added in 1.0.0
@MainThread
open fun onComplicationActivated(
    complicationInstanceId: Int,
    type: ComplicationType
): Unit

Called when a complication is activated.

This occurs when the watch face calls setActiveComplications, or when this data source is chosen for a complication which is already active.

This will usually be followed by a call to onComplicationRequest.

This will be called on the main thread.

Parameters
complicationInstanceId: Int

The system's ID for the complication. Note this ID is distinct from the complication slot used by the watch face itself.

type: ComplicationType

The ComplicationType of the activated slot.

onComplicationDeactivated

Added in 1.0.0
@MainThread
open fun onComplicationDeactivated(complicationInstanceId: Int): Unit

Called when a complication is deactivated.

This occurs when the current watch face changes, or when the watch face calls setActiveComplications and does not include the given complication (usually because the watch face has stopped displaying it).

This will be called on the main thread.

Parameters
complicationInstanceId: Int

The system's ID for the complication. Note this ID is distinct from the complication slot used by the watch face itself.

onComplicationRequest

Added in 1.0.0
@MainThread
abstract fun onComplicationRequest(
    request: ComplicationRequest,
    listener: ComplicationDataSourceService.ComplicationRequestListener
): Unit

Called when a complication data update is requested for the given complication id.

In response to this request the result callback should be called with the data to be displayed. If the request can not be fulfilled or no update is needed then null should be passed to the callback.

The callback doesn't have be called within onComplicationRequest but it should be called soon after. If this does not occur within around 20 seconds (exact timeout length subject to change), then the system will unbind from this service which may cause your eventual update to not be received. However if ComplicationRequest.immediateResponseRequired is true then provider should try to deliver the response in under 100 milliseconds, if false the deadline is 20 seconds. ComplicationRequest.immediateResponseRequired will only ever be true if METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS is present in the manifest, and the provider has the privileged permission com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE, and the complication is visible and non-ambient.

Parameters
request: ComplicationRequest

The details about the complication that has been requested.

listener: ComplicationDataSourceService.ComplicationRequestListener

The callback to pass the result to the system.

onStartImmediateComplicationRequests

Added in 1.1.0
@MainThread
open fun onStartImmediateComplicationRequests(complicationInstanceId: Int): Unit

If a metadata key with METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS is present in the manifest, and the provider has privileged permission com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE, then onStartImmediateComplicationRequests will be called when the watch face is visible and non-ambient. A series of onComplicationRequests will follow where ComplicationRequest.immediateResponseRequired is true, ending with a call to onStopImmediateComplicationRequests.

Parameters
complicationInstanceId: Int

The system's ID for the complication. Note this ID is distinct from the complication slot used by the watch face itself.

onStopImmediateComplicationRequests

Added in 1.1.0
@MainThread
open fun onStopImmediateComplicationRequests(complicationInstanceId: Int): Unit

If a metadata key with METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS is present in the manifest, and the provider has privileged permission com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE, then onStartImmediateComplicationRequests will be called when the watch face ceases to be visible and non-ambient. No subsequent calls to onComplicationRequest where ComplicationRequest.immediateResponseRequired is true will be made unless the complication becomes visible and non-ambient again.

Parameters
complicationInstanceId: Int

The system's ID for the complication. Note this ID is distinct from the complication slot used by the watch face itself.