public abstract class

WatchFaceService.Engine

extends WallpaperService.Engine

Note: The Wearable Support Library classes under the android.support.wearable package are subject to change. For the full Android API reference, see Reference.

java.lang.Object
   ↳ android.service.wallpaper.WallpaperService.Engine
     ↳ android.support.wearable.watchface.WatchFaceService.Engine
Known Direct Subclasses

Class Overview

The actual implementation of a watch face. You must implement onCreateEngine() to return your concrete Engine implementation.

Summary

Public Constructors
WatchFaceService.Engine()
Public Methods
final int getInterruptionFilter()
Returns interruption filter selected by the user.
final Rect getPeekCardPosition()
Returns the location of the first peeking card.
final int getUnreadCount()
Returns the number of unread notification cards in the stream.
final boolean isInAmbientMode()
Returns whether the watch face is in ambient mode.
void onAmbientModeChanged(boolean inAmbientMode)
Called when the device enters or exits ambient mode.
Bundle onCommand(String action, int x, int y, int z, Bundle extras, boolean resultRequested)
void onCreate(SurfaceHolder holder)
void onDestroy()
void onInterruptionFilterChanged(int interruptionFilter)
Called when the user changes interruption filter.
void onPeekCardPositionUpdate(Rect rect)
Called when the first, peeking card positions itself on the screen.
void onPropertiesChanged(Bundle properties)
Called when the properties of the device are determined.
void onTimeTick()
Called periodically to update the time shown by the watch face.
void onUnreadCountChanged(int count)
Called when the number of unread notification cards in the stream has changed.
void onVisibilityChanged(boolean visible)
Called to inform you of the watch face becoming visible or hidden.
void setWatchFaceStyle(WatchFaceStyle watchFaceStyle)
Sets the watch face style.
[Expand]
Inherited Methods
From class android.service.wallpaper.WallpaperService.Engine
From class java.lang.Object

Public Constructors

public WatchFaceService.Engine ()

Public Methods

public final int getInterruptionFilter ()

Returns interruption filter selected by the user.

public final Rect getPeekCardPosition ()

Returns the location of the first peeking card. This doesn't provide information about all movements of the card, only about its location when it's peeking at the bottom and allowing the watch face to be exposed.

public final int getUnreadCount ()

Returns the number of unread notification cards in the stream.

public final boolean isInAmbientMode ()

Returns whether the watch face is in ambient mode. When true, the watch face should display in white on black.

public void onAmbientModeChanged (boolean inAmbientMode)

Called when the device enters or exits ambient mode. The watch face should switch to a black and white display in ambient mode. If the watch face displays seconds, it should hide them in ambient mode.

public Bundle onCommand (String action, int x, int y, int z, Bundle extras, boolean resultRequested)

public void onCreate (SurfaceHolder holder)

public void onDestroy ()

public void onInterruptionFilterChanged (int interruptionFilter)

Called when the user changes interruption filter. 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 INTERRUPTION_FILTER_NONE. interruptionFilter can be INTERRUPTION_FILTER_NONE, INTERRUPTION_FILTER_PRIORITY or INTERRUPTION_FILTER_ALL.

public void onPeekCardPositionUpdate (Rect rect)

Called when the first, peeking card positions itself on the screen. This is where the watch face can change its appearance depending on where the card is on the screen. This doesn't provide information about all movements of the card, only about its location when it's peeking at the bottom and allowing the watch face to be exposed.

public void onPropertiesChanged (Bundle properties)

Called when the properties of the device are determined. These include PROPERTY_BURN_IN_PROTECTION and PROPERTY_LOW_BIT_AMBIENT.

Parameters
properties a bundle containing the hardware properties

public void onTimeTick ()

Called periodically to update the time shown by the watch face. This method is called:

  • at least once per minute in both ambient and interactive modes
  • when date or time has changed
  • when timezone has changed

public void onUnreadCountChanged (int count)

Called when the number of unread notification cards in the stream has changed.

Parameters
count number of the notification cards in the stream that haven't yet been seen by the user

public void onVisibilityChanged (boolean visible)

Called to inform you of the watch face becoming visible or hidden. If you decide to override this method, you must call super.onVisibilityChanged(visible) as the first statement in your override.

public void setWatchFaceStyle (WatchFaceStyle watchFaceStyle)

Sets the watch face style. This affects how UI elements such as the battery indicator are drawn on top of the watch face. Typically called in onCreate(SurfaceHolder) but may be called at any time, e.g. in response to the user changing the watch face configuration. Must be called from the wallpaper thread.