WatchFaceMetadataClient


interface WatchFaceMetadataClient : AutoCloseable


Interface for fetching watch face metadata. E.g. the UserStyleSchema and ComplicationSlotMetadata. This must be closed after use to release resources.

use Watch Face Format instead

Summary

Nested types

This class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

This class is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public companion functions

suspend WatchFaceMetadataClient
create(context: Context, watchFaceName: ComponentName)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

suspend WatchFaceMetadataClient
createForRuntime(
    context: Context,
    watchFaceName: ComponentName,
    runtimePackage: String
)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public functions

Map<IntComplicationSlotMetadata>

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

UserStyleFlavors

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

UserStyleSchema

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public properties

Boolean

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Inherited functions

From java.lang.AutoCloseable
Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public companion functions

create

suspend fun create(context: Context, watchFaceName: ComponentName): WatchFaceMetadataClient

Constructs a WatchFaceMetadataClient for fetching metadata for the specified watch face.

Parameters
context: Context

Calling application's Context.

watchFaceName: ComponentName

The ComponentName of the watch face to fetch meta data from.

Returns
WatchFaceMetadataClient

The WatchFaceMetadataClient if there is one.

Throws
androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceNotBoundException

if the underlying watch face control service can not be bound or a ServiceStartFailureException if the watch face dies during startup. If the service's manifest contains an androidx.wear.watchface.XmlSchemaAndComplicationSlotsDefinition meta data node then PackageManager.NameNotFoundException is thrown if watchFaceName is invalid.

createForRuntime

suspend fun createForRuntime(
    context: Context,
    watchFaceName: ComponentName,
    runtimePackage: String
): WatchFaceMetadataClient

Constructs a WatchFaceMetadataClient for fetching metadata for the specified resource only watch face from its runtime. A resource only watch face runtime is a special watch face that knows how to load watch faces from resources in another package that contains only resources and no executable code.

Parameters
context: Context

Calling application's Context.

watchFaceName: ComponentName

The ComponentName of the watch face to fetch meta data from.

runtimePackage: String

The package that contains the Resource only Watch Face runtime.

Returns
WatchFaceMetadataClient

The WatchFaceMetadataClient if there is one.

Throws
androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceNotBoundException

if the underlying watch face control service can not be bound or a ServiceStartFailureException if the watch face dies during startup. If the service's manifest contains an androidx.wear.watchface.XmlSchemaAndComplicationSlotsDefinition meta data node then PackageManager.NameNotFoundException is thrown if watchFaceName is invalid.

Public functions

getComplicationSlotMetadataMap

Added in 1.1.0
Deprecated in 1.3.0-alpha06
fun getComplicationSlotMetadataMap(): Map<IntComplicationSlotMetadata>

Returns a map of androidx.wear.watchface.ComplicationSlot ID to ComplicationSlotMetadata for each slot in the watch face's androidx.wear.watchface.ComplicationSlotsManager.

Throws
kotlin.RuntimeException

if the watch face threw an exception while trying to service the request or there was a communication problem with watch face process.

getUserStyleFlavors

Added in 1.2.0
Deprecated in 1.3.0-alpha06
fun getUserStyleFlavors(): UserStyleFlavors

Returns the watch face's UserStyleFlavors.

Throws
kotlin.RuntimeException

if the watch face threw an exception while trying to service the request or there was a communication problem with watch face process.

getUserStyleSchema

Added in 1.1.0
Deprecated in 1.3.0-alpha06
fun getUserStyleSchema(): UserStyleSchema

Returns the watch face's UserStyleSchema.

Throws
kotlin.RuntimeException

if the watch face threw an exception while trying to service the request or there was a communication problem with watch face process.

Public properties

isUserStyleSchemaStatic

Added in 1.1.0
Deprecated in 1.3.0-alpha06
val isUserStyleSchemaStaticBoolean

Whether or not the UserStyleSchema is static and won't change unless the APK is updated.