ComplicationDataSourceService.Companion

object ComplicationDataSourceService.Companion


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 an action for a configuration activity for a complication data source.

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.

const String

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

Constants

ACTION_COMPLICATION_UPDATE_REQUEST

const val ACTION_COMPLICATION_UPDATE_REQUESTString

The intent action used to send update requests to the data source. Complication data source services 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_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_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 o 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.

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 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 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"/>