Google is committed to advancing racial equity for Black communities. See how.

HeadlessWatchFaceClient

class HeadlessWatchFaceClient : AutoCloseable
kotlin.Any
   ↳ androidx.wear.watchface.client.HeadlessWatchFaceClient

Controls a stateless remote headless watch face.

Summary

Public constructors
<init>(binder: IBinder)

Constructs a HeadlessWatchFaceClient from a IBinder.

Public methods
IBinder

Returns the associated IBinder.

Unit

Releases the watch face instance.

Bitmap?
takeComplicationScreenshot(complicationId: Int, renderParameters: RenderParameters, @IntRange(0, 100) compressionQuality: Int, calendarTimeMillis: Long, complicationData: ComplicationData, userStyle: UserStyle?)

Requests for a WebP compressed shared memory backed Bitmap containing a screenshot of the complication with the given settings.

Bitmap
takeWatchFaceScreenshot(renderParameters: RenderParameters, @IntRange(0, 100) compressionQuality: Int, calendarTimeMillis: Long, userStyle: UserStyle?, idToComplicationData: Map<Int, ComplicationData>?)

Requests for a WebP compressed shared memory backed Bitmap containing a screenshot of the watch face with the given settings.

Properties
Map<Int, ComplicationState>

Map of complication ids to ComplicationState for each complication slot.

Long

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

UserStyleSchema

The watch face's UserStyleSchema.

Public constructors

<init>

HeadlessWatchFaceClient(binder: IBinder)

Constructs a HeadlessWatchFaceClient from a IBinder.

Public methods

asBinder

fun asBinder(): IBinder

Returns the associated IBinder. Allows this interface to be passed over AIDL.

close

fun close(): Unit

Releases the watch face instance. It is an error to issue any further commands on this interface.

takeComplicationScreenshot

fun takeComplicationScreenshot(
    complicationId: Int,
    renderParameters: RenderParameters,
    @IntRange(0, 100) compressionQuality: Int,
    calendarTimeMillis: Long,
    complicationData: ComplicationData,
    userStyle: UserStyle?
): Bitmap?

Requests for a WebP compressed shared memory backed Bitmap containing a screenshot of the complication with the given settings.

Parameters
complicationId: Int The id of the complication to render
renderParameters: RenderParameters The RenderParameters to draw with
compressionQuality: Int The WebP compression quality, 100 = loss less
calendarTimeMillis: Long The UTC time in milliseconds since the epoch to render with
complicationData: ComplicationData the ComplicationData to render with
userStyle: UserStyle? Optional UserStyle to render with, if null the default style is used
Return
A WebP compressed shared memory backed Bitmap containing a screenshot of the watch face with the given settings, or null if complicationId is unrecognized.

takeWatchFaceScreenshot

fun takeWatchFaceScreenshot(
    renderParameters: RenderParameters,
    @IntRange(0, 100) compressionQuality: Int,
    calendarTimeMillis: Long,
    userStyle: UserStyle?,
    idToComplicationData: Map<Int, ComplicationData>?
): Bitmap

Requests for a WebP compressed shared memory backed Bitmap containing a screenshot of the watch face with the given settings.

Parameters
renderParameters: RenderParameters The RenderParameters to draw with.
compressionQuality: Int The WebP compression quality, 100 = loss less.
calendarTimeMillis: Long The UTC time in milliseconds since the epoch to render with.
userStyle: UserStyle? Optional UserStyle to render with, if null the default style is used.
idToComplicationData: Map<Int, ComplicationData>? Map of complication ids to ComplicationData to render with, or if null complications are not rendered.
Return
A WebP compressed shared memory backed Bitmap containing a screenshot of the watch face with the given settings.

Properties

complicationState

val complicationState: Map<Int, ComplicationState>

Map of complication ids to ComplicationState for each complication slot. Note this can change, typically in response to styling.

previewReferenceTimeMillis

val previewReferenceTimeMillis: Long

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

userStyleSchema

val userStyleSchema: UserStyleSchema

The watch face's UserStyleSchema.