WatchFacePushManager
public
final
class
WatchFacePushManager
extends Object
| java.lang.Object | |
| ↳ | com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager |
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 Sdk.getWearManager(Context, Class)
API.
Summary
Nested classes | |
|---|---|
class |
WatchFacePushManager.AddException
Exception representing an error of the |
class |
WatchFacePushManager.IsActiveException
Exception representing an error of the |
class |
WatchFacePushManager.ListException
Exception representing an error of the |
class |
WatchFacePushManager.ReceiverConnectionException
Exception thrown when there is a problem with the Watch Face Receiver Service connection, such as:
|
class |
WatchFacePushManager.RemoveException
Exception representing an error of the |
class |
WatchFacePushManager.SetActiveException
Exception representing an error of the |
class |
WatchFacePushManager.UpdateException
Exception representing an error of the |
Public methods | |
|---|---|
void
|
addWatchFace(ParcelFileDescriptor apkFd, String validationToken, Executor callbackExecutor, OutcomeReceiver<WatchFaceSlot, WatchFacePushManager.AddException> outcomeReceiver)
Adds a new watch face to this device, creating a |
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. |
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. |
void
|
removeWatchFace(String slotId, Executor callbackExecutor, OutcomeReceiver<Void, WatchFacePushManager.RemoveException> outcomeReceiver)
Removes a watch face slot that was previously created using the |
void
|
setWatchFaceAsActive(String slotId, Executor callbackExecutor, OutcomeReceiver<Void, WatchFacePushManager.SetActiveException> outcomeReceiver)
Sets the watch face with the given |
void
|
updateWatchFace(String slotId, ParcelFileDescriptor apkFd, String validationToken, Executor callbackExecutor, OutcomeReceiver<WatchFaceSlot, WatchFacePushManager.UpdateException> outcomeReceiver)
Updates the watch face with the given slot ID. |
Inherited methods | |
|---|---|
Public methods
addWatchFace
public void addWatchFace (ParcelFileDescriptor apkFd,
String validationToken,
Executor callbackExecutor,
OutcomeReceiver<WatchFaceSlot, WatchFacePushManager.AddException> outcomeReceiver)Adds a new watch face to this device, creating a 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 AddException with a status of AddException.ADD_SLOT_LIMIT_REACHED_ERROR will be received via the outcome receiver. After
the cap is reached, a client can still invoke updateWatchFace(String, ParcelFileDescriptor, String, Executor, OutcomeReceiver) to change a watch
face, or removeWatchFace(String, Executor, OutcomeReceiver) to be allowed to add a new watch face. The number of free
slots can be queried via the ListWatchFaceSlotsResponse.getAvailableSlotCount(), on
the object returned by listWatchFaceSlots(Executor, OutcomeReceiver).
Requires com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_PUSH_WATCH_FACES
| Parameters | |
|---|---|
apkFd |
ParcelFileDescriptor: the ParcelFileDescriptor containing the watch face APK to be added. The
watch face must be implemented using the Watch Face Format 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 ParcelFileDescriptor can be
obtained using the ParcelFileDescriptor.createPipe API. |
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 AddException.ADD_INVALID_VALIDATION_TOKEN_ERROR. |
callbackExecutor |
Executor: the executor the callback will be executed on. |
outcomeReceiver |
OutcomeReceiver: the outcome receiver to receive the result or error. |
isWatchFaceActive
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 IsActiveException.IS_ACTIVE_FORBIDDEN_ERROR will be received
through the given outcomeReceiver.
Requires com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_PUSH_WATCH_FACES
| Parameters | |
|---|---|
watchFacePackageName |
String: the package name of the watch face to query. |
callbackExecutor |
Executor: the executor the callback will be executed on. |
outcomeReceiver |
OutcomeReceiver: the outcome receiver to receive the result or error. |
listWatchFaceSlots
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 updateWatchFace(String, ParcelFileDescriptor, String, Executor, OutcomeReceiver) or removeWatchFace(String, Executor, OutcomeReceiver) 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
| Parameters | |
|---|---|
callbackExecutor |
Executor: the executor the callback will be executed on. |
outcomeReceiver |
OutcomeReceiver: the outcome receiver to receive the result or error. |
removeWatchFace
public void removeWatchFace (String slotId,
Executor callbackExecutor,
OutcomeReceiver<Void, WatchFacePushManager.RemoveException> outcomeReceiver)Removes a watch face slot that was previously created using the addWatchFace(ParcelFileDescriptor, String, Executor, OutcomeReceiver) 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
| Parameters | |
|---|---|
slotId |
String: the slot ID of the watch face to remove. |
callbackExecutor |
Executor: the executor the callback will be executed on. |
outcomeReceiver |
OutcomeReceiver: the outcome receiver to receive the result or error. |
setWatchFaceAsActive
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 addWatchFace(ParcelFileDescriptor, String, Executor, OutcomeReceiver) 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
| Parameters | |
|---|---|
slotId |
String: the slot ID of the watch face to set as active. |
callbackExecutor |
Executor: the executor the callback will be executed on. |
outcomeReceiver |
OutcomeReceiver: the outcome receiver to receive the result or error. |
updateWatchFace
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.
Requires com.google.wear.services.watchfaces.watchfacepush.WatchFacePushManager.PERMISSION_PUSH_WATCH_FACES
| Parameters | |
|---|---|
slotId |
String: the slot ID of the watch face to update. |
apkFd |
ParcelFileDescriptor: the 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 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 ParcelFileDescriptor can be
obtained using the ParcelFileDescriptor.createPipe API. |
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 UpdateException.UPDATE_INVALID_VALIDATION_TOKEN_ERROR. |
callbackExecutor |
Executor: the executor the callback will be executed on. |
outcomeReceiver |
OutcomeReceiver: the outcome receiver to receive the result or error. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-06-11 UTC.