# WatchFacePushManager.AddWatchFaceException

Artifact: [androidx.wear.watchfacepush:watchfacepush](https://developer.android.com/jetpack/androidx/releases/wear-watchfacepush) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchfacepush/WatchFacePush.kt+class:androidx.wear.watchfacepush.WatchFacePushManager.AddWatchFaceException) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchfacepush#1.0.0)

*** ** * ** ***


```
public final class WatchFacePushManager.AddWatchFaceException extends Exception
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [kotlin.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) |||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) ||
|   |   | ↳ | [androidx.wear.watchfacepush.WatchFacePushManager.AddWatchFaceException](https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException) |

*** ** * ** ***

An exception that can be thrown by `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager#addWatchFace(android.os.ParcelFileDescriptor,kotlin.String)`

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_INVALID_PACKAGE_NAME()` The package name of the watch face is invalid. |
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_INVALID_VALIDATION_TOKEN()` The validation token provided does not match the watch face. |
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_MALFORMED_WATCHFACE_APK()` The provided watch face is not a valid Android APK. |
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_SLOT_LIMIT_REACHED()` The limit of watch faces that can be installed by this application has been reached. |
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_UNEXPECTED_CONTENT()` Unexpected content in the APK. |
| `static final int` | `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_UNKNOWN()` Unknown error while adding a watch face. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#AddWatchFaceException(kotlin.Int,kotlin.Throwable)(int errorCode, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html rootCause)` |

| ### Public methods |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#getErrorCode()()` The specific subtype of error occurred. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#getMessage()()` |

### Inherited methods

From [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) `final void` `https://developer.android.com/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html exception)` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#fillInStackTrace()()` `https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#getCause()()` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `@https://developer.android.com/reference/androidx/annotation/RecentlyNullable
https://developer.android.com/reference/java/lang/Throwable.html#getLocalizedMessage()()` `@https://developer.android.com/reference/androidx/annotation/NonNull StackTraceElement[]` `@https://developer.android.com/reference/androidx/annotation/RecentlyNonNull
https://developer.android.com/reference/java/lang/Throwable.html#getStackTrace()()` `final @https://developer.android.com/reference/androidx/annotation/NonNull Throwable[]` `@https://developer.android.com/reference/androidx/annotation/RecentlyNonNull
https://developer.android.com/reference/java/lang/Throwable.html#getSuppressed()()` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#initCause(java.lang.Throwable)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html cause)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace()()` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintStream)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/PrintStream.html s)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintWriter)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/PrintWriter.html s)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[])(@https://developer.android.com/reference/androidx/annotation/NonNull StackTraceElement[] stackTrace)`

## Constants

### ERROR_INVALID_PACKAGE_NAME

```
public static final int ERROR_INVALID_PACKAGE_NAME
```

The package name of the watch face is invalid.

The package name of the watch face must start with the package name of the Watch Face Push client, followed by the 'watchfacepush' keyword, ending with the unique watch face name. Developers should verify that the package name follows this format.

### ERROR_INVALID_VALIDATION_TOKEN

```
public static final int ERROR_INVALID_VALIDATION_TOKEN
```

The validation token provided does not match the watch face.

Developers should see the Watch Face Push documentation to see how to generate a validation token correctly.

### ERROR_MALFORMED_WATCHFACE_APK

```
public static final int ERROR_MALFORMED_WATCHFACE_APK
```

The provided watch face is not a valid Android APK.

Developers should ensure that the provided file is a valid APK file.

### ERROR_SLOT_LIMIT_REACHED

```
public static final int ERROR_SLOT_LIMIT_REACHED
```

The limit of watch faces that can be installed by this application has been reached.

No more watch faces can be added. Developers should instruct the user to remove existing watch faces added by this app before attempting to add new ones.

### ERROR_UNEXPECTED_CONTENT

```
public static final int ERROR_UNEXPECTED_CONTENT
```

Unexpected content in the APK.

The APK must be a WFF watchface which only contains the watchface XML file and the associated resources. The APK can't contain any executable code. Developers should ensure that the APK conforms to the Watch Face Format.

### ERROR_UNKNOWN

```
public static final int ERROR_UNKNOWN
```

Unknown error while adding a watch face.

This typically means that the Watch Face Push service on the watch could not be accessed or that the watch may be in a bad state.

## Public constructors

### AddWatchFaceException

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

```
public AddWatchFaceException(int errorCode, @NonNull Throwable rootCause)
```

| Parameters |
|---|---|
| `int errorCode` | The specific subtype of error occurred. See `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException.Companion.ErrorCode` for the possible values. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html rootCause` | The exception that caused the problem in the first place. |

## Public methods

### getErrorCode

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

```
public final int getErrorCode()
```

The specific subtype of error occurred. See `https://developer.android.com/reference/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException.Companion.ErrorCode` for the possible values.

### getMessage

```
public String getMessage()
```