MetadataConstants

open class MetadataConstants
kotlin.Any
   ↳ androidx.wear.utils.MetadataConstants

Constants for android wear apps which are related to manifest meta-data.

Summary

Constants
static String

The value of the notification bridge mode meta-data element in the case where the Wear app wants notifications to be bridged from the phone to the wearable.

static String

We support specifying whether notifications should be bridged from the phone to the wearable in the Wear app manifest file.

static String

The value of the notification bridge mode meta-data element in the case where the Wear app does not want notifications to be bridged from the phone to the wearable.

static String

The name of the meta-data element in the Wear app manifest for specifying whether this app does not require a companion phone app.

static String

The name of the meta-data element in the watch face service manifest declaration used to assign a circular preview image to the watch face.

static String

The name of the meta-data element in the watch face service manifest declaration used to assign a non-circular preview image to the watch face.

Public methods
open static Boolean
isStandalone(context: Context!)

Determines whether a given context comes from a standalone app.

open static Boolean

Determines whether a given context has notification bridging enabled.

open static Int

Constants

NOTIFICATION_BRIDGE_MODE_BRIDGING

static val NOTIFICATION_BRIDGE_MODE_BRIDGING: String

The value of the notification bridge mode meta-data element in the case where the Wear app wants notifications to be bridged from the phone to the wearable.

Value: "BRIDGING"

NOTIFICATION_BRIDGE_MODE_METADATA_NAME

static val NOTIFICATION_BRIDGE_MODE_METADATA_NAME: String

We support specifying whether notifications should be bridged from the phone to the wearable in the Wear app manifest file. Simply add a meta-data element to the Wear app manifest with the name "com.google.android.wearable.notificationBridgeMode" and either the value NO_BRIDGING or the value BRIDGING. If you choose not to update your Wear app manifest, then notifications will be bridged by default from the phone to the wearable.

NO_BRIDGING means that phone notifications will not be bridged to the wearable if the wearable app is installed.

BRIDGING means that phone notifications will be bridged to the wearable, unless they are posted with setLocalOnly(true).

Example AndroidManifest.xml meta-data element for NO_BRIDGING:

<meta-data android:name="com.google.android.wearable.notificationBridgeMode" android:value="NO_BRIDGING" /> 

Example AndroidManifest.xml meta-data element for BRIDGING:

<meta-data android:name="com.google.android.wearable.notificationBridgeMode" android:value="BRIDGING" /> 
Value: "com.google.android.wearable.notificationBridgeMode"

NOTIFICATION_BRIDGE_MODE_NO_BRIDGING

static val NOTIFICATION_BRIDGE_MODE_NO_BRIDGING: String

The value of the notification bridge mode meta-data element in the case where the Wear app does not want notifications to be bridged from the phone to the wearable.

Value: "NO_BRIDGING"

STANDALONE_METADATA_NAME

static val STANDALONE_METADATA_NAME: String

The name of the meta-data element in the Wear app manifest for specifying whether this app does not require a companion phone app. The value should be set to "true" or "false".

Wear apps that do not require a phone side companion app to function can declare this in their AndroidManifest.xml file by setting the standalone meta-data element to true as shown in the following example. If this value is true, all users can discover this app regardless of what phone they have. If this value is false (or not set), only users with compatible Android phones can discover this app.

<meta-data android:name="com.google.android.wearable.standalone" android:value="true" /> 
Value: "com.google.android.wearable.standalone"

WATCH_FACE_PREVIEW_CIRCULAR_METADATA_NAME

static val WATCH_FACE_PREVIEW_CIRCULAR_METADATA_NAME: String

The name of the meta-data element in the watch face service manifest declaration used to assign a circular preview image to the watch face. The value should be set to a drawable reference.

 <meta-data android:name="com.google.android.wearable.watchface.preview_circular" android:resource="@drawable/preview_face_circular" /> 

Value: "com.google.android.wearable.watchface.preview_circular"

WATCH_FACE_PREVIEW_METADATA_NAME

static val WATCH_FACE_PREVIEW_METADATA_NAME: String

The name of the meta-data element in the watch face service manifest declaration used to assign a non-circular preview image to the watch face. The value should be set to a drawable reference.

 <meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/preview_face" /> 

Value: "com.google.android.wearable.watchface.preview"

Public methods

isStandalone

open static fun isStandalone(context: Context!): Boolean

Determines whether a given context comes from a standalone app. This can be used as a proxy to check if any given app is compatible with iOS Companion devices.

Parameters
context Context!: to be evaluated.
Return
Boolean: Whether a given context comes from a standalone app.

isNotificationBridgingEnabled

open static fun isNotificationBridgingEnabled(context: Context!): Boolean

Determines whether a given context has notification bridging enabled.

Parameters
context Context!: to be evaluated.
Return
Boolean: Whether a given context has notification bridging enabled.

getPreviewDrawableResourceId

open static fun getPreviewDrawableResourceId(context: Context!, circular: Boolean): Int
Parameters
context Context!: to be evaluated.
circular Context!: Whether to return the circular or regular preview.
Return
Int: an integer id representing the resource id of the requested drawable, or 0 if no drawable was found.