# WatchFace.TapListener

Artifact: [androidx.wear.watchface:watchface](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/WatchFace.kt+class:androidx.wear.watchface.WatchFace.TapListener) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

*** ** * ** ***


```
public interface WatchFace.TapListener
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Listens for taps on the watchface.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [onTapEvent](https://developer.android.com/reference/androidx/wear/watchface/WatchFace.TapListener#onTapEvent(kotlin.Int,androidx.wear.watchface.TapEvent,androidx.wear.watchface.ComplicationSlot))( int tapType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/TapEvent tapEvent, https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot complicationSlot )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

## Public methods

### onTapEvent

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
@UiThread
abstract void [onTapEvent](https://developer.android.com/reference/androidx/wear/watchface/WatchFace.TapListener#onTapEvent(kotlin.Int,androidx.wear.watchface.TapEvent,androidx.wear.watchface.ComplicationSlot))(
    int tapType,
    @NonNull TapEvent tapEvent,
    ComplicationSlot complicationSlot
)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Called whenever the user taps on the watchface.

The watch face receives three different types of touch events:

- `https://developer.android.com/reference/androidx/wear/watchface/TapType#DOWN()` when the user puts the finger down on the touchscreen

- `https://developer.android.com/reference/androidx/wear/watchface/TapType#UP()` when the user lifts the finger from the touchscreen

- `https://developer.android.com/reference/androidx/wear/watchface/TapType#CANCEL()` when the system detects that the user is performing a gesture other than a tap

Note that the watch face is only given tap events, i.e., events where the user puts the finger down on the screen and then lifts it at the position. If the user performs any other type of gesture while their finger in on the touchscreen, the watch face will be receive a cancel, as all other gestures are reserved by the system.

Therefore, a `https://developer.android.com/reference/androidx/wear/watchface/TapType#DOWN()` event and the successive `https://developer.android.com/reference/androidx/wear/watchface/TapType#UP()` event are guaranteed to be close enough to be considered a tap according to the value returned by `https://developer.android.com/reference/android/view/ViewConfiguration.html#getScaledTouchSlop()`.

If the watch face receives a `https://developer.android.com/reference/androidx/wear/watchface/TapType#CANCEL()` event, it should not trigger any action, as the system is already processing the gesture.

| Parameters |
|---|---|
| `int tapType` | The type of touch event sent to the watch face Value is one of the following: - `0` - `2` - `1` <br /> |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/TapEvent tapEvent` | The received `https://developer.android.com/reference/androidx/wear/watchface/TapEvent` |
| `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot complicationSlot` | The `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` tapped if any or `null` otherwise |