InteractiveWatchFaceClient

interface InteractiveWatchFaceClient


Controls a stateful remote interactive watch face. Typically this will be used for the current active watch face.

Note clients should call close when finished.

Summary

Nested types

InteractiveWatchFaceClient.ClientDisconnectListener

Callback that observes when the client disconnects.

InteractiveWatchFaceClient.Companion
InteractiveWatchFaceClient.OnWatchFaceReadyListener

Interface passed to addOnWatchFaceReadyListener which calls OnWatchFaceReadyListener.onWatchFaceReady when the watch face is ready to render.

Public fields

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

Map of androidx.wear.watchface.ComplicationSlot ids to ComplicationSlotState for each ComplicationSlot registered with the watch face's ComplicationSlotsManager.

abstract @NonNull List<@NonNull ContentDescriptionLabel>

Returns the ContentDescriptionLabels describing the watch face, for the use by screen readers.

abstract @NonNull String

Returns the ID of this watch face instance.

abstract @NonNull Instant

The UTC reference preview time for this watch face in milliseconds since the epoch.

abstract @NonNull UserStyleSchema

The watch face's UserStyleSchema.

Public methods

abstract @AnyThread void

Registers a ClientDisconnectListener.

abstract void

Registers a OnWatchFaceReadyListener which gets called when the watch face is ready to render.

default Integer
getComplicationIdAt(@Px int x, @Px int y)

Returns the ID of the androidx.wear.watchface.ComplicationSlot at the given coordinates or null if there isn't one.

default PendingIntent
getPendingIntentForTouchEvent(
    @Px int xPosition,
    @Px int yPosition,
    @TapType int tapType
)

Sends a tap event to the watch face for processing and returns a PendingIntent if the user tapped on complication, which should be sent on the watch face's behalf.

abstract @AnyThread boolean

Returns true if the connection to the server side is alive.

abstract void

Triggers watch face rendering into the surface when in ambient mode.

abstract @AnyThread void

Removes a ClientDisconnectListener previously registered by addClientDisconnectListener.

abstract void

Stops listening for events registered by addOnWatchFaceReadyListener.

abstract @RequiresApi(value = 27) @NonNull Bitmap
renderWatchFaceToBitmap(
    RenderParameters renderParameters,
    Instant instant,
    UserStyle userStyle,
    Map<IntegerComplicationData> idAndComplicationData
)

Renders the watchface to a shared memory backed Bitmap with the given settings.

abstract void
sendTouchEvent(@Px int xPosition, @Px int yPosition, @TapType int tapType)

Sends a tap event to the watch face for processing.

abstract void

Updates the watch faces WatchUiState.

default boolean

Whether or not the watch face supports getPendingIntentForTouchEvent.

abstract void
updateComplicationData(
    Map<IntegerComplicationData> slotIdToComplicationData
)

Sends new ComplicationData to the watch face.

abstract void
updateWatchFaceInstance(String newInstanceId, UserStyle userStyle)

Renames this instance to newInstanceId (must be unique, usually this would be different from the old ID but that's not a requirement).

abstract void
updateWatchFaceInstance(String newInstanceId, UserStyleData userStyle)

Renames this instance to newInstanceId (must be unique, usually this would be different from the old ID but that's not a requirement).

Inherited methods

From class AutoCloseable
abstract void

Public fields

complicationSlotsState