Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#nestedclasses) \| [Methods](https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#inhmethods)

# WatchFacePushManager


`
public

final

class
WatchFacePushManager
`


`

extends Object


`

`


`

|---|---|
| java.lang.Object ||
| ↳ | com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager |

<br />

*** ** * ** ***

Watch Face Push APIs that allow a third party to to add, update and remove watch faces using
built with the Watch Face Format.

An instance of this class can be obtained using the `https://developer.android.com/reference/com/google/wear/Sdk#getWearManager(android.content.Context,%20java.lang.Class<T>)`
API.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.AddException` Exception representing an error of the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#addWatchFace(android.os.ParcelFileDescriptor,%20java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.WatchFaceSlot,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.AddException>)` method. |
| ` class` | `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.IsActiveException` Exception representing an error of the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#isWatchFaceActive(java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Boolean,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.IsActiveException>)` method. |
| ` class` | `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.ListException` Exception representing an error of the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#listWatchFaceSlots(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.ListWatchFaceSlotsResponse,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.ListException>)` method. |
| ` class` | `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.ReceiverConnectionException` Exception thrown when there is a problem with the Watch Face Receiver Service connection, such as: - unsuccessful binding. <br /> |
| ` class` | `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.RemoveException` Exception representing an error of the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#removeWatchFace(java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Void,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.RemoveException>)` method. |
| ` class` | `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.SetActiveException` Exception representing an error of the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#removeWatchFace(java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Void,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.RemoveException>)` method. |
| ` class` | `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.UpdateException` Exception representing an error of the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#updateWatchFace(java.lang.String,%20android.os.ParcelFileDescriptor,%20java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.WatchFaceSlot,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.UpdateException>)` method. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#addWatchFace(android.os.ParcelFileDescriptor,%20java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.WatchFaceSlot,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.AddException>)(ParcelFileDescriptor apkFd, String validationToken, Executor callbackExecutor, OutcomeReceiver<https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFaceSlot, https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.AddException> outcomeReceiver) ` Adds a new watch face to this device, creating a `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFaceSlot`. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#isWatchFaceActive(java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Boolean,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.IsActiveException>)(String watchFacePackageName, Executor callbackExecutor, OutcomeReceiver<Boolean, https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.IsActiveException> outcomeReceiver) ` Returns whether the watch face with the given package name is set as the current watch face on the device. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#listWatchFaceSlots(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.ListWatchFaceSlotsResponse,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.ListException>)(Executor callbackExecutor, OutcomeReceiver<https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/ListWatchFaceSlotsResponse, https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.ListException> outcomeReceiver) ` Lists all the watch faces that were added by the app invoking this method, paired with their associated slot ID, along with the number of available slots remaining. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#removeWatchFace(java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Void,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.RemoveException>)(String slotId, Executor callbackExecutor, OutcomeReceiver<Void, https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.RemoveException> outcomeReceiver) ` Removes a watch face slot that was previously created using the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#addWatchFace(android.os.ParcelFileDescriptor,%20java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.WatchFaceSlot,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.AddException>)` method. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#setWatchFaceAsActive(java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Void,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.SetActiveException>)(String slotId, Executor callbackExecutor, OutcomeReceiver<Void, https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.SetActiveException> outcomeReceiver) ` Sets the watch face with the given `slotId` as the active watch face. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#updateWatchFace(java.lang.String,%20android.os.ParcelFileDescriptor,%20java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.WatchFaceSlot,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.UpdateException>)(String slotId, ParcelFileDescriptor apkFd, String validationToken, Executor callbackExecutor, OutcomeReceiver<https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFaceSlot, https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.UpdateException> outcomeReceiver) ` Updates the watch face with the given slot ID. |

| ### Inherited methods |
|---|---|
| From class ` java.lang.Object ` |---|---| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class<?>` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||

## Public methods

### addWatchFace

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addWatchFace (ParcelFileDescriptor apkFd, 
                String validationToken, 
                Executor callbackExecutor, 
                OutcomeReceiver<WatchFaceSlot, WatchFacePushManager.AddException> outcomeReceiver)
```

Adds a new watch face to this device, creating a `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFaceSlot`. A watch face slot is
an identifier used for managing pushed watch faces

Watch faces can be uninstalled from outside the Watch Face Push API (e.g. from system
settings), causing slot IDs to become invalid. It is not recommended for clients to persist
these IDs, but rather to query them at the beginning of each user journey.

There is a cap on the number of watch faces that a client is allowed to add and when this
cap is reached, a `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.AddException` with a status of `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.AddException#ADD_SLOT_LIMIT_REACHED_ERROR` will be received via the outcome receiver. After
the cap is reached, a client can still invoke `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#updateWatchFace(java.lang.String,%20android.os.ParcelFileDescriptor,%20java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.WatchFaceSlot,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.UpdateException>)` to change a watch
face, or `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#removeWatchFace(java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Void,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.RemoveException>)` to be allowed to add a new watch face. The number of free
slots can be queried via the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/ListWatchFaceSlotsResponse#getAvailableSlotCount()`, on
the object returned by `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#listWatchFaceSlots(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.ListWatchFaceSlotsResponse,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.ListException>)`.


Requires com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_PUSH_WATCH_FACES

<br />

| Parameters ||
|---|---|
| `apkFd` | `ParcelFileDescriptor`: the `https://developer.android.com/reference/android/os/ParcelFileDescriptor` containing the watch face APK to be added. The watch face must be implemented using the [Watch Face Format](https://developer.android.com/training/wearables/wff) and the package name must start with the package name of the app invoking this method, followed by the word `.watchfacepush.`, followed by the watch face identifier, for example `com.my.app.watchfacepush.my.watch.face`. A `https://developer.android.com/reference/android/os/ParcelFileDescriptor` can be obtained using the `https://developer.android.com/reference/android/os/ParcelFileDescriptor#createPipe()` API. <br /> |
| `validationToken` | `String`: A token proving that the watchface has been gone through the required validation checks. An invalid token will result in an exception with status `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.AddException#ADD_INVALID_VALIDATION_TOKEN_ERROR`. <br /> |
| `callbackExecutor` | `Executor`: the executor the callback will be executed on. <br /> |
| `outcomeReceiver` | `OutcomeReceiver`: the outcome receiver to receive the result or error. <br /> |

### isWatchFaceActive

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void isWatchFaceActive (String watchFacePackageName, 
                Executor callbackExecutor, 
                OutcomeReceiver<Boolean, WatchFacePushManager.IsActiveException> outcomeReceiver)
```

Returns whether the watch face with the given package name is set as the current watch face
on the device.

A client is only allowed to check a watch face that it previously added. If the watch face
identified by the given package name was not added by the client invoking this method, an
exception with status `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.IsActiveException#IS_ACTIVE_FORBIDDEN_ERROR` will be received
through the given outcomeReceiver.


Requires com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_PUSH_WATCH_FACES

<br />

| Parameters ||
|---|---|
| `watchFacePackageName` | `String`: the package name of the watch face to query. <br /> |
| `callbackExecutor` | `Executor`: the executor the callback will be executed on. <br /> |
| `outcomeReceiver` | `OutcomeReceiver`: the outcome receiver to receive the result or error. <br /> |

### listWatchFaceSlots

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void listWatchFaceSlots (Executor callbackExecutor, 
                OutcomeReceiver<ListWatchFaceSlotsResponse, WatchFacePushManager.ListException> outcomeReceiver)
```

Lists all the watch faces that were added by the app invoking this method, paired with their
associated slot ID, along with the number of available slots remaining. Each slot ID can be
used to `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#updateWatchFace(java.lang.String,%20android.os.ParcelFileDescriptor,%20java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.WatchFaceSlot,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.UpdateException>)` or `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#removeWatchFace(java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<java.lang.Void,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.RemoveException>)` the watch face.

Watch faces can be uninstalled from outside the Watch Face Push API (e.g. from system
settings), causing slot IDs to become invalid. It is not recommended for clients to persist
these IDs, but rather to query them at the beginning of each user journey.


Requires com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_PUSH_WATCH_FACES

<br />

| Parameters ||
|---|---|
| `callbackExecutor` | `Executor`: the executor the callback will be executed on. <br /> |
| `outcomeReceiver` | `OutcomeReceiver`: the outcome receiver to receive the result or error. <br /> |

### removeWatchFace

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeWatchFace (String slotId, 
                Executor callbackExecutor, 
                OutcomeReceiver<Void, WatchFacePushManager.RemoveException> outcomeReceiver)
```

Removes a watch face slot that was previously created using the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#addWatchFace(android.os.ParcelFileDescriptor,%20java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.WatchFaceSlot,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.AddException>)` method.

A watch face slot is an identifier used to manage watch faces. When removing a slot, the
necessary clean up is performed, so that the underlying watch face is uninstalled.


Requires com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_PUSH_WATCH_FACES

<br />

| Parameters ||
|---|---|
| `slotId` | `String`: the slot ID of the watch face to remove. <br /> |
| `callbackExecutor` | `Executor`: the executor the callback will be executed on. <br /> |
| `outcomeReceiver` | `OutcomeReceiver`: the outcome receiver to receive the result or error. <br /> |

### setWatchFaceAsActive

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setWatchFaceAsActive (String slotId, 
                Executor callbackExecutor, 
                OutcomeReceiver<Void, WatchFacePushManager.SetActiveException> outcomeReceiver)
```

Sets the watch face with the given `slotId` as the active watch face.

The watch face needs to be previously added using the `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager#addWatchFace(android.os.ParcelFileDescriptor,%20java.lang.String,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<com.google.wear.services.watchfaces.watchfacepush.WatchFaceSlot,com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.AddException>)` method.


Requires com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_PUSH_WATCH_FACES and com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_SET_PUSHED_WATCH_FACE_AS_ACTIVE

<br />

| Parameters ||
|---|---|
| `slotId` | `String`: the slot ID of the watch face to set as active. <br /> |
| `callbackExecutor` | `Executor`: the executor the callback will be executed on. <br /> |
| `outcomeReceiver` | `OutcomeReceiver`: the outcome receiver to receive the result or error. <br /> |

### updateWatchFace

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void updateWatchFace (String slotId, 
                ParcelFileDescriptor apkFd, 
                String validationToken, 
                Executor callbackExecutor, 
                OutcomeReceiver<WatchFaceSlot, WatchFacePushManager.UpdateException> outcomeReceiver)
```

Updates the watch face with the given slot ID. The behaviour of this method depends on the
package name of the provided watch face APK:

- If the provided APK has the same package name as the watch face currently identified with the given slot ID, then the operation is considered an iterative update. All the configurations that the user made to the watch face (user style settings) are preserved. If the watch face allows multiple instances, with different user style settings, in the watch face picker, then all of the instances are preserved as well. The version code of the provided APK must be greater than or equal to the version code of the watch face currently identified by the slot ID.
- If the provided APK has a different package name than the watch face currently identified with the given slot ID, then the operation is considered a full replacement of the watch face. The user style settings of the previous watch face, as well as all the instances for watch faces that support multiple instances, will be lost. If the previous watch face was set as active, meaning it was the current watch face on the device, then the provided watch face will be set as active.

Note: for details about watch faces with multiple instances, see [this
doc](https://developer.android.com/training/wearables/wff/setup#declare-metadata).


Requires com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_PUSH_WATCH_FACES

<br />

| Parameters ||
|---|---|
| `slotId` | `String`: the slot ID of the watch face to update. <br /> |
| `apkFd` | `ParcelFileDescriptor`: the `https://developer.android.com/reference/android/os/ParcelFileDescriptor` containing the watch face APK with which the given slot should be updated. The watch face must be implemented using the [Watch Face Format](https://developer.android.com/training/wearables/wff) and the package name must start with the package name of the app invoking this method, followed by the word `.watchfacepush.`, followed by the watch face identifier, for example `com.my.app.watchfacepush.my.watch.face`. A `https://developer.android.com/reference/android/os/ParcelFileDescriptor` can be obtained using the `https://developer.android.com/reference/android/os/ParcelFileDescriptor#createPipe()` API. <br /> |
| `validationToken` | `String`: A token proving that the watchface has been gone through the required validation checks. An invalid token will result in an exception with status `https://developer.android.com/reference/com/google/wear/services/watchfaces/watchfacepush/WatchFacePushManager.UpdateException#UPDATE_INVALID_VALIDATION_TOKEN_ERROR`. <br /> |
| `callbackExecutor` | `Executor`: the executor the callback will be executed on. <br /> |
| `outcomeReceiver` | `OutcomeReceiver`: the outcome receiver to receive the result or error. <br /> |