DefaultComplicationDataSourcePolicy


class DefaultComplicationDataSourcePolicy


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 (e.g. it isn't installed or it doesn't support the requested type, or the watch face lacks the necessary permission) then the next one will be 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.

Summary

Public constructors

No default complication data source.

This function is deprecated. Use a constructor that sets the DefaultTypes

DefaultComplicationDataSourcePolicy(
    dataSource: ComponentName,
    systemDataSourceFallback: Int
)

This function is deprecated. Use a constructor that sets the DefaultTypes

DefaultComplicationDataSourcePolicy(
    systemDataSource: Int,
    systemDataSourceDefaultType: ComplicationType
)

Uses a system data source as the default complication data source.

DefaultComplicationDataSourcePolicy(
    primaryDataSource: ComponentName,
    secondaryDataSource: ComponentName,
    systemDataSourceFallback: Int
)

This function is deprecated. Use a constructor that sets the DefaultTypes

DefaultComplicationDataSourcePolicy(
    primaryDataSource: ComponentName,
    primaryDataSourceDefaultType: ComplicationType,
    systemDataSourceFallback: Int,
    systemDataSourceFallbackDefaultType: ComplicationType
)

Attempts to use primaryDataSource as the default complication complication data source, if not present then systemDataSourceFallback will be used instead.

DefaultComplicationDataSourcePolicy(
    primaryDataSource: ComponentName,
    primaryDataSourceDefaultType: ComplicationType,
    secondaryDataSource: ComponentName,
    secondaryDataSourceDefaultType: ComplicationType,
    systemDataSourceFallback: Int,
    systemDataSourceFallbackDefaultType: ComplicationType
)

Attempts to use primaryDataSource as the default complication data source, if not present then secondaryDataSource will be tried and if that's not present then systemDataSourceFallback will be used instead.

Public functions

open operator Boolean
equals(other: Any?)
open Int
Boolean

Whether or not this DefaultComplicationDataSourcePolicy contains a default data source.

open String

Public properties

ComponentName?

First of two non-system data sources to be tried in turn.

ComplicationType?

The default ComplicationType for primaryDataSource.

ComponentName?

Second of two non-system data sources to be tried in turn.

ComplicationType?

The default ComplicationType for secondaryDataSource.

Int

Fallback in case none of the non-system data sources could be used.

ComplicationType

The default ComplicationType for systemDataSourceFallback.

Public constructors

DefaultComplicationDataSourcePolicy

Added in 1.0.0
DefaultComplicationDataSourcePolicy()

No default complication data source.

DefaultComplicationDataSourcePolicy

Added in 1.0.0
Deprecated in 1.1.0
DefaultComplicationDataSourcePolicy(systemProvider: Int)

Uses systemProvider as the default complication data source.

DefaultComplicationDataSourcePolicy

Added in 1.0.0
Deprecated in 1.1.0
DefaultComplicationDataSourcePolicy(
    dataSource: ComponentName,
    systemDataSourceFallback: Int
)

Attempts to use dataSource as the default complication complication data source, if not present then systemDataSourceFallback will be used instead.

DefaultComplicationDataSourcePolicy

Added in 1.1.0
DefaultComplicationDataSourcePolicy(
    systemDataSource: Int,
    systemDataSourceDefaultType: ComplicationType
)

Uses a system data source as the default complication data source.

Parameters
systemDataSource: Int

The system DataSourceId data source to use.

systemDataSourceDefaultType: ComplicationType

The initial default ComplicationType.

DefaultComplicationDataSourcePolicy

Added in 1.0.0
Deprecated in 1.1.0
DefaultComplicationDataSourcePolicy(
    primaryDataSource: ComponentName,
    secondaryDataSource: ComponentName,
    systemDataSourceFallback: Int
)

Attempts to use primaryDataSource as the default complication data source, if not present then secondaryDataSource will be tried and if that's not present then systemDataSourceFallback will be used instead.

DefaultComplicationDataSourcePolicy

Added in 1.1.0
DefaultComplicationDataSourcePolicy(
    primaryDataSource: ComponentName,
    primaryDataSourceDefaultType: ComplicationType,
    systemDataSourceFallback: Int,
    systemDataSourceFallbackDefaultType: ComplicationType
)

Attempts to use primaryDataSource as the default complication complication data source, if not present then systemDataSourceFallback will be used instead.

Parameters
primaryDataSource: ComponentName

The data source to try.

primaryDataSourceDefaultType: ComplicationType

The default ComplicationType if primaryDataSource is selected. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

systemDataSourceFallback: Int

The system data source to fall back on if neither provider is available.

systemDataSourceFallbackDefaultType: ComplicationType

The default ComplicationType if systemDataSourceFallback is selected.

DefaultComplicationDataSourcePolicy

Added in 1.1.0
DefaultComplicationDataSourcePolicy(
    primaryDataSource: ComponentName,
    primaryDataSourceDefaultType: ComplicationType,
    secondaryDataSource: ComponentName,
    secondaryDataSourceDefaultType: ComplicationType,
    systemDataSourceFallback: Int,
    systemDataSourceFallbackDefaultType: ComplicationType
)

Attempts to use primaryDataSource as the default complication data source, if not present then secondaryDataSource will be tried and if that's not present then systemDataSourceFallback will be used instead.

Parameters
primaryDataSource: ComponentName

The first data source to try.

primaryDataSourceDefaultType: ComplicationType

The default ComplicationType if primaryDataSource is selected. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

secondaryDataSource: ComponentName

The second data source to try.

secondaryDataSourceDefaultType: ComplicationType

The default ComplicationType if secondaryDataSource is selected. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

systemDataSourceFallback: Int

The system data source to fall back on if neither provider is available.

systemDataSourceFallbackDefaultType: ComplicationType

The default ComplicationType if systemDataSourceFallback is selected.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

isEmpty

Added in 1.0.0
fun isEmpty(): Boolean

Whether or not this DefaultComplicationDataSourcePolicy contains a default data source.

toString

open fun toString(): String

Public properties

primaryDataSource

Added in 1.0.0
val primaryDataSourceComponentName?

First of two non-system data sources to be tried in turn. Set to null if not required.

primaryDataSourceDefaultType

Added in 1.1.0
val primaryDataSourceDefaultTypeComplicationType?

The default ComplicationType for primaryDataSource. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

secondaryDataSource

Added in 1.0.0
val secondaryDataSourceComponentName?

Second of two non-system data sources to be tried in turn. Set to null if not required.

secondaryDataSourceDefaultType

Added in 1.1.0
val secondaryDataSourceDefaultTypeComplicationType?

The default ComplicationType for secondaryDataSource. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

systemDataSourceFallback

Added in 1.0.0
val systemDataSourceFallbackInt

Fallback in case none of the non-system data sources could be used.

systemDataSourceFallbackDefaultType

Added in 1.1.0
val systemDataSourceFallbackDefaultTypeComplicationType

The default ComplicationType for systemDataSourceFallback.