WatchState
public final class WatchState
Describes the current state of the wearable including some hardware details such as whether or not it supports burn in prevention and low-bit ambient.
Summary
Public constructors |
|---|
This method is deprecated. WatchState constructors without watchFaceInstanceId are deprecated |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public methods |
|
|---|---|
final long |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @Px int |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final long |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull StateFlow<Integer> |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull StateFlow<@NonNull String> |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final boolean |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final boolean |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull StateFlow<Boolean> |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull StateFlow<Boolean> |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final boolean |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull StateFlow<Boolean> |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public constructors
publicWatchState(
@NonNull StateFlow<Integer> interruptionFilter,
@NonNull StateFlow<Boolean> isAmbient,
@NonNull StateFlow<Boolean> isBatteryLowAndNotCharging,
@NonNull StateFlow<Boolean> isVisible,
boolean hasLowBitAmbient,
boolean hasBurnInProtection,
long analogPreviewReferenceTimeMillis,
long digitalPreviewReferenceTimeMillis,
int chinHeight,
boolean isHeadless
)
WatchState
publicWatchState(
@NonNull StateFlow<Integer> interruptionFilter,
@NonNull StateFlow<Boolean> isAmbient,
@NonNull StateFlow<Boolean> isBatteryLowAndNotCharging,
@NonNull StateFlow<Boolean> isVisible,
boolean hasLowBitAmbient,
boolean hasBurnInProtection,
long analogPreviewReferenceTimeMillis,
long digitalPreviewReferenceTimeMillis,
@Px int chinHeight,
boolean isHeadless,
@NonNull StateFlow<@NonNull String> watchFaceInstanceId
)
| Parameters | |
|---|---|
@NonNull StateFlow<Integer> interruptionFilter |
The current user interruption settings. See |
@NonNull StateFlow<Boolean> isAmbient |
Whether or not the watch is in ambient mode. This is initially |
@NonNull StateFlow<Boolean> isBatteryLowAndNotCharging |
Whether or not we should conserve power due to a low battery which isn't charging. This is initially |
@NonNull StateFlow<Boolean> isVisible |
Whether or not the watch face is visible. This is initially |
boolean hasLowBitAmbient |
Whether or not the watch hardware supports low bit ambient support. |
boolean hasBurnInProtection |
Whether or not the watch hardware supports burn in protection. |
long analogPreviewReferenceTimeMillis |
UTC reference time for previews of analog watch faces in milliseconds since the epoch. |
long digitalPreviewReferenceTimeMillis |
UTC reference time for previews of digital watch faces in milliseconds since the epoch. |
@Px int chinHeight |
the size, in pixels, of the chin or zero if the device does not have a chin. A chin is a section at the bottom of a circular display that is visible due to hardware limitations. |
boolean isHeadless |
Whether or not this is a headless watchface. |
@NonNull StateFlow<@NonNull String> watchFaceInstanceId |
The ID associated with the watch face instance. Note there may be more than one instance associated with a @deprecated use Watch Face Format instead |
Public methods
getAnalogPreviewReferenceTimeMillis
public final long getAnalogPreviewReferenceTimeMillis()UTC reference time for previews of analog watch faces in milliseconds since the epoch.
getChinHeight
public final @Px intgetChinHeight()
the size, in pixels, of the chin or zero if the device does not have a chin. A chin is a section at the bottom of a circular display that is visible due to hardware limitations.
getDigitalPreviewReferenceTimeMillis
public final long getDigitalPreviewReferenceTimeMillis()UTC reference time for previews of digital watch faces in milliseconds since the epoch.
getInterruptionFilter
public final @NonNull StateFlow<Integer>getInterruptionFilter()
The current user interruption settings. See NotificationManager. This is initially null because the watch face is created before the system has sent the state. Based on the value the watch face should adjust the amount of information it displays. For example, if it displays the number of pending emails, it should hide it if interruptionFilter is equal to NotificationManager.INTERRUPTION_FILTER_NONE. interruptionFilter can be NotificationManager.INTERRUPTION_FILTER_NONE, NotificationManager.INTERRUPTION_FILTER_PRIORITY, NotificationManager.INTERRUPTION_FILTER_ALL, NotificationManager.INTERRUPTION_FILTER_ALARMS, or NotificationManager.INTERRUPTION_FILTER_UNKNOWN.
getWatchFaceInstanceId
public final @NonNull StateFlow<@NonNull String>getWatchFaceInstanceId()
The ID associated with the watch face instance. Note there may be more than one instance associated with a WatchFaceService. See androidx.wear.watchface.client.WatchFaceId for more details.
@deprecated use Watch Face Format instead
hasBurnInProtection
public final boolean hasBurnInProtection()Whether or not the watch hardware supports burn in protection.
hasLowBitAmbient
public final boolean hasLowBitAmbient()Whether or not the watch hardware supports low bit ambient support.
isAmbient
public final @NonNull StateFlow<Boolean>isAmbient()
Whether or not the watch is in ambient mode. This is initially null because the watch face is created before the system has sent the state. The order in which ambient vs style changes are reported is not guaranteed. Likewise the order of isAmbient flow callbacks and Renderer.CanvasRenderer.render or Renderer.GlesRenderer.render calls is not defined. For rendering please refer to RenderParameters.drawMode instead of isAmbient because you might receive requests for rendering non-ambient frames while the watch is ambient (e.g. editing from the companion phone).
isBatteryLowAndNotCharging
public final @NonNull StateFlow<Boolean>isBatteryLowAndNotCharging()
Whether or not we should conserve power due to a low battery which isn't charging. This is initially null because the watch face is created before the system has sent the state. Only valid if android.support.wearable.watchface.WatchFaceStyle.hideNotificationIndicator is true.
isHeadless
public final boolean isHeadless()Whether or not this is a headless watchface.