# WatchFace

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) 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 final class WatchFace
```

<br />

*** ** * ** ***

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

The return value of `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceService#createWatchFace(android.view.SurfaceHolder,androidx.wear.watchface.WatchState,androidx.wear.watchface.ComplicationSlotsManager,androidx.wear.watchface.style.CurrentUserStyleRepository)` which brings together rendering, styling, complicationSlots and state observers.

use Watch Face Format instead

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/watchface/WatchFace.LegacyWatchFaceOverlayStyle` **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `public final class https://developer.android.com/reference/androidx/wear/watchface/WatchFace.OverlayStyle` **This class is deprecated.** OverlayStyle will be removed in a future release. |
| `public interface https://developer.android.com/reference/androidx/wear/watchface/WatchFace.TapListener` **This interface is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public constructors |
|---|
| `[WatchFace](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#WatchFace(kotlin.Int,androidx.wear.watchface.Renderer))(int watchFaceType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/Renderer renderer)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace.LegacyWatchFaceOverlayStyle` | `[getLegacyWatchFaceStyle](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getLegacyWatchFaceStyle())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace.OverlayStyle` | `[getOverlayStyle](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getOverlayStyle())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final https://developer.android.com/reference/java/time/Instant.html` | `[getOverridePreviewReferenceInstant](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getOverridePreviewReferenceInstant())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/Renderer` | `[getRenderer](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getRenderer())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final int` | `[getWatchFaceType](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getWatchFaceType())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `static final boolean` | `[isLegacyWatchFaceOverlayStyleSupported](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#isLegacyWatchFaceOverlayStyleSupported())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace` | `[setComplicationDeniedDialogIntent](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setComplicationDeniedDialogIntent(android.content.Intent))( https://developer.android.com/reference/android/content/Intent.html complicationDeniedDialogIntent )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace` | `[setComplicationRationaleDialogIntent](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setComplicationRationaleDialogIntent(android.content.Intent))( https://developer.android.com/reference/android/content/Intent.html complicationRationaleDialogIntent )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace` | `[setLegacyWatchFaceStyle](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setLegacyWatchFaceStyle(androidx.wear.watchface.WatchFace.LegacyWatchFaceOverlayStyle))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace.LegacyWatchFaceOverlayStyle legacyWatchFaceStyle )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace` | `[setOverlayStyle](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setOverlayStyle(androidx.wear.watchface.WatchFace.OverlayStyle))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace.OverlayStyle watchFaceOverlayStyle)` **This method is deprecated.** OverlayStyle will be removed in a future release. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace` | `[setOverridePreviewReferenceInstant](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setOverridePreviewReferenceInstant(java.time.Instant))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html previewReferenceTimeMillis )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace` | `[setTapListener](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setTapListener(androidx.wear.watchface.WatchFace.TapListener))(https://developer.android.com/reference/androidx/wear/watchface/WatchFace.TapListener tapListener)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/WatchFace` | `[setUpdateScreenshotOnConfigurationChange](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setUpdateScreenshotOnConfigurationChange(kotlin.Boolean))( boolean updateScreenshotOnConfigurationChange )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `[setWatchFaceType](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setWatchFaceType(kotlin.Int))(int value)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

## Public constructors

### WatchFace

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 [WatchFace](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#WatchFace(kotlin.Int,androidx.wear.watchface.Renderer))(int watchFaceType, @NonNull Renderer renderer)
```

> [!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

| Parameters |
|---|---|
| `int watchFaceType` | The type of watch face, whether it's digital or analog. Used to determine the default time for editor preview screenshots. Value is one of the following: - `1` - `0` <br /> |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/Renderer renderer` | The `https://developer.android.com/reference/androidx/wear/watchface/Renderer` for this WatchFace. |

## Public methods

### getLegacyWatchFaceStyle

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 final @NonNull WatchFace.LegacyWatchFaceOverlayStyle [getLegacyWatchFaceStyle](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getLegacyWatchFaceStyle())()
```

> [!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

The legacy `https://developer.android.com/reference/androidx/wear/watchface/WatchFace.LegacyWatchFaceOverlayStyle` which only affects Wear 2.0 devices.

### getOverlayStyle

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

```
public final @NonNull WatchFace.OverlayStyle [getOverlayStyle](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getOverlayStyle())()
```

> [!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

The `https://developer.android.com/reference/androidx/wear/watchface/WatchFace.OverlayStyle`. This feature is unimplemented on any platform, and will be removed.

### getOverridePreviewReferenceInstant

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 final Instant [getOverridePreviewReferenceInstant](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getOverridePreviewReferenceInstant())()
```

> [!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

The `https://developer.android.com/reference/java/time/Instant.html` to use for preview rendering, or `null` if not set in which case the system chooses the Instant to use.

### getRenderer

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 final @NonNull Renderer [getRenderer](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getRenderer())()
```

> [!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

The `https://developer.android.com/reference/androidx/wear/watchface/Renderer` for this WatchFace.

### getWatchFaceType

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 final int [getWatchFaceType](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#getWatchFaceType())()
```

> [!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

The type of watch face, whether it's digital or analog. Used to determine the default time for editor preview screenshots.

### isLegacyWatchFaceOverlayStyleSupported

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 static final boolean [isLegacyWatchFaceOverlayStyleSupported](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#isLegacyWatchFaceOverlayStyleSupported())()
```

> [!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

Returns whether `https://developer.android.com/reference/androidx/wear/watchface/WatchFace.LegacyWatchFaceOverlayStyle` is supported on this device.

### setComplicationDeniedDialogIntent

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

```
public final @NonNull WatchFace [setComplicationDeniedDialogIntent](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setComplicationDeniedDialogIntent(android.content.Intent))(
    Intent complicationDeniedDialogIntent
)
```

> [!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

Sets the `https://developer.android.com/reference/android/content/Intent.html` to launch an activity which explains the watch face needs permission to display complications. It is recommended the activity have a button which launches an intent with `https://developer.android.com/reference/android/provider/Settings.html#ACTION_APPLICATION_DETAILS_SETTINGS` to allow the user to grant permissions if they wish.

This `https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setComplicationDeniedDialogIntent(android.content.Intent)` is launched when the user tries to configure a complication slot when the `com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA` permission has been denied. If the intent is not set or is `null` then no dialog will be displayed.

### setComplicationRationaleDialogIntent

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

```
public final @NonNull WatchFace [setComplicationRationaleDialogIntent](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setComplicationRationaleDialogIntent(android.content.Intent))(
    Intent complicationRationaleDialogIntent
)
```

> [!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

Sets the `https://developer.android.com/reference/android/content/Intent.html` to launch an activity that explains the rational for the requesting the com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA`permission prior to requesting it, if [Activity.shouldShowRequestPermissionRationale] returns `true\`.

If the intent is not set or is `null` then no dialog will be displayed.

### setLegacyWatchFaceStyle

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 final @NonNull WatchFace [setLegacyWatchFaceStyle](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setLegacyWatchFaceStyle(androidx.wear.watchface.WatchFace.LegacyWatchFaceOverlayStyle))(
    @NonNull WatchFace.LegacyWatchFaceOverlayStyle legacyWatchFaceStyle
)
```

> [!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

Sets the legacy `https://developer.android.com/reference/androidx/wear/watchface/WatchFace.LegacyWatchFaceOverlayStyle` which only affects Wear 2.0 devices.

### setOverlayStyle

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

```
public final @NonNull WatchFace [setOverlayStyle](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setOverlayStyle(androidx.wear.watchface.WatchFace.OverlayStyle))(@NonNull WatchFace.OverlayStyle watchFaceOverlayStyle)
```

> [!CAUTION]
> **This method is deprecated.**   
> OverlayStyle will be removed in a future release.

Sets the `https://developer.android.com/reference/androidx/wear/watchface/WatchFace.OverlayStyle` which is ignored because this feature is unimplemented on any platform, and will be removed.

### setOverridePreviewReferenceInstant

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 final @NonNull WatchFace [setOverridePreviewReferenceInstant](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setOverridePreviewReferenceInstant(java.time.Instant))(
    @NonNull Instant previewReferenceTimeMillis
)
```

> [!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

Overrides the reference time for editor preview images.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html previewReferenceTimeMillis` | The UTC preview time in milliseconds since the epoch |

### setTapListener

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 final @NonNull WatchFace [setTapListener](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setTapListener(androidx.wear.watchface.WatchFace.TapListener))(WatchFace.TapListener tapListener)
```

> [!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

Sets an optional `https://developer.android.com/reference/androidx/wear/watchface/WatchFace.TapListener` which if not `null` gets called on the ui thread whenever the user taps on the watchface.

### setUpdateScreenshotOnConfigurationChange

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

```
public final @NonNull WatchFace [setUpdateScreenshotOnConfigurationChange](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setUpdateScreenshotOnConfigurationChange(kotlin.Boolean))(
    boolean updateScreenshotOnConfigurationChange
)
```

> [!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

If `https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setUpdateScreenshotOnConfigurationChange(kotlin.Boolean)` is true then whenever `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceService#onConfigurationChanged(android.content.res.Configuration)` gets called while this watch face is active then a request will be made for the system to update the watch's screenshot displayed in the picker.

By default this is off.

Note if `https://developer.android.com/reference/androidx/wear/watchface/WatchFaceService#onConfigurationChanged(android.content.res.Configuration)` or `https://developer.android.com/reference/androidx/wear/watchface/Renderer#sendPreviewImageNeedsUpdateRequest()` get called very frequently then the system may throttle the rate at which screenshots are taken.

### setWatchFaceType

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 final void [setWatchFaceType](https://developer.android.com/reference/androidx/wear/watchface/WatchFace#setWatchFaceType(kotlin.Int))(int value)
```

> [!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

| Parameters |
|---|---|
| `int value` | The type of watch face, whether it's digital or analog. Used to determine the default time for editor preview screenshots. |