A user can interact with your watch face in many ways. For example, a user might tap the watch face to learn what song is currently playing, or to see the day's agenda. Wear OS by Google allows watch faces to accept the single-tap gesture at a given location on the watch face, as long as there's not another UI element that also responds to that gesture.
This lesson teaches you how to implement an interactive watch face by first constructing the watch face style, and then implementing gesture handling.
Handle tap events
The watch face is only given tap events, which are events where the user puts the finger down on the screen and then lifts it. If the user performs any other type of gesture while their finger is on the touchscreen, the watch face receives a cancel event, as all other gestures are reserved by the system for other functions.
The watch face receives the following types of touch events:
TapType.DOWN: when the user puts their finger down on the touchscreen
TapType.UP: when the user lifts the finger from the touchscreen
TapType.CANCEL: when the system detects that the user is performing a gesture other than a tap
If the watch face receives a
event, it should not trigger any action, as the system is already processing the gesture.
Watch face sample demonstrates the best practices for configuring a watch face.