A watch face may wish to try and set one or more non-system data sources as the default data source for a complication. If a complication data source can't be used for some reason -- such as when it isn't installed or it doesn't support the requested type -- then the next one is tried. A system complication data source acts as a final fallback in case no non-system data sources can be used.
If the DefaultComplicationDataSourcePolicy
is empty, then no default is set.
Introduced in Wear OS 4.
Syntax
<DefaultProviderPolicy defaultSystemProvider="string" defaultSystemProviderType="string" />
Attributes
A DefaultProviderPolicy
has the following attributes:
Required attributes
The following attributes are required:
defaultSystemProvider
The
defaultSystemProvider
is a system complication data source that acts as a final fallback in case no primary or secondary providers are specified, or no non-system data sources can be used. ThedefaultSystemProvider
attribute should be set to a string constant value derived from the list of WearSystemDataSources
values, such asSTEP_COUNT
.The full list of available values is:
APP_SHORTCUT
DATE
DAY_OF_WEEK
FAVORITE_CONTACT
HEART_RATE
NEXT_EVENT
STEP_COUNT
SUNRISE_SUNSET
TIME_AND_DATE
UNREAD_NOTIFICATION_COUNT
WATCH_BATTERY
WORLD_CLOCK
DAY_AND_DATE
EMPTY
defaultSystemProviderType
- The type of the
defaultSystemProvider
to disambiguate where a system provider supports multiple types. Supported values areSHORT_TEXT
,LONG_TEXT
,MONOCHROMATIC_IMAGE
,SMALL_IMAGE
,PHOTO_IMAGE
,RANGED_VALUE
, andEMPTY
.
Optional attributes
The following attributes are optional:
primaryProvider
- The component name of the first data source to try.
primaryProviderType
- The default Complication Type if a primaryProvider is selected. Supported
values are
SHORT_TEXT
,LONG_TEXT
,MONOCHROMATIC_IMAGE
,SMALL_IMAGE
,PHOTO_IMAGE
,RANGED_VALUE
, andEMPTY
secondaryProvider
- The component name of the second data source to try.
secondaryProviderType
- The default Complication Type if a secondaryProvider is selected. Supported
values are
SHORT_TEXT
,LONG_TEXT
,MONOCHROMATIC_IMAGE
,SMALL_IMAGE
,PHOTO_IMAGE
,RANGED_VALUE
, andEMPTY
Recommended for you
(Deprecated) Exposing data to watch face complications on Wear OS
In this codelab, you’ll learn how to expose your data to watch face complications while keeping best practices for the platform in mind.