WatchFaceControlClient

interface WatchFaceControlClient

Known direct subclasses
ListenableWatchFaceControlClient

ListenableFuture-based compatibility wrapper around WatchFaceControlClient's suspending methods.


Connects to a watch face's WatchFaceControlService which allows the user to control the watch face.

Summary

Nested types

WatchFaceControlClient.Companion
WatchFaceControlClient.ServiceNotBoundException

Exception thrown by createWatchFaceControlClient if the remote service can't be bound.

WatchFaceControlClient.ServiceStartFailureException

Exception thrown by WatchFaceControlClient methods if the service dies during start up.

Public methods

abstract HeadlessWatchFaceClient
createHeadlessWatchFaceClient(
    ComponentName watchFaceName,
    DeviceConfig deviceConfig,
    @Px int surfaceWidth,
    @Px int surfaceHeight
)

This method is deprecated. Creating a headless client without a watchface ID is deprecated

default HeadlessWatchFaceClient
createHeadlessWatchFaceClient(
    String id,
    ComponentName watchFaceName,
    DeviceConfig deviceConfig,
    @Px int surfaceWidth,
    @Px int surfaceHeight
)

Creates a HeadlessWatchFaceClient with the specified DeviceConfig.

abstract @NonNull Map<@NonNull Integer, @NonNull DefaultComplicationDataSourcePolicyAndType>

This method is deprecated. Use the WatchFaceMetadataClient instead.

abstract @NonNull EditorServiceClient
abstract InteractiveWatchFaceClient

Returns the InteractiveWatchFaceClient for the given instance id, or null if no such instance exists.

abstract @NonNull InteractiveWatchFaceClient
getOrCreateInteractiveWatchFaceClient(
    String id,
    DeviceConfig deviceConfig,
    WatchUiState watchUiState,
    UserStyleData userStyle,
    Map<IntegerComplicationData> slotIdToComplicationData
)

Requests either an existing InteractiveWatchFaceClient with the specified id or schedules creation of an InteractiveWatchFaceClient for the next time the WallpaperService creates an engine.

default boolean

Whether or not the watch face has a ComplicationData cache.

Inherited methods

From class AutoCloseable
abstract void

Public methods

createHeadlessWatchFaceClient

abstract HeadlessWatchFaceClient createHeadlessWatchFaceClient(
    ComponentName watchFaceName,
    DeviceConfig deviceConfig,
    @Px int surfaceWidth,
    @Px int surfaceHeight
)

Creates a HeadlessWatchFaceClient with the specified DeviceConfig. Screenshots made with HeadlessWatchFaceClient.renderWatchFaceToBitmap will be surfaceWidth x surfaceHeight in size.

When finished call HeadlessWatchFaceClient.close to release resources.

Parameters
ComponentName watchFaceName

The ComponentName of the watch face to create a headless instance for must be in the same APK the WatchFaceControlClient is connected to. NB a single apk can contain multiple watch faces.

DeviceConfig deviceConfig

The hardware DeviceConfig

@Px int surfaceWidth

The width of screen shots taken by the HeadlessWatchFaceClient

@Px int surfaceHeight

The height of screen shots taken by the HeadlessWatchFaceClient

Returns
HeadlessWatchFaceClient

The HeadlessWatchFaceClient or null if watchFaceName is unrecognized.

createHeadlessWatchFaceClient

default HeadlessWatchFaceClient createHeadlessWatchFaceClient(
    String id,
    ComponentName watchFaceName,
    DeviceConfig deviceConfig,
    @Px int surfaceWidth,
    @Px int surfaceHeight
)

Creates a HeadlessWatchFaceClient with the specified DeviceConfig. Screenshots made with HeadlessWatchFaceClient.renderWatchFaceToBitmap will be surfaceWidth x surfaceHeight in size.

When finished call HeadlessWatchFaceClient.close to release resources.

Parameters
String id

The ID for the requested HeadlessWatchFaceClient, will be exposed to the watch face via androidx.wear.watchface.WatchState.watchFaceInstanceId.

ComponentName<