WatchFaceMetadataClient.Companion


Note: As of July 10, 2024, watch faces must use the Watch Face Format in order to be installed on new watches that launch with Wear OS 5 pre-installed. Learn more about the user-facing changes in this Help Center article.

Additionally, starting in early 2025 (specific date to be announced during Q4 2024), all new watch faces published on Google Play must use the Watch Face Format.

public static class WatchFaceMetadataClient.Companion


Summary

Public methods

static final @NonNull WatchFaceMetadataClient
create(@NonNull Context context, @NonNull ComponentName watchFaceName)

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

static final @NonNull WatchFaceMetadataClient
createForRuntime(
    @NonNull Context context,
    @NonNull ComponentName watchFaceName,
    @NonNull String runtimePackage
)

Constructs a WatchFaceMetadataClient for fetching metadata for the specified resource only watch face from its runtime.

Public methods

create

public static final @NonNull WatchFaceMetadataClient create(@NonNull Context context, @NonNull ComponentName watchFaceName)

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

Parameters
@NonNull Context context

Calling application's Context.

@NonNull ComponentName watchFaceName

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

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

public static final @NonNull WatchFaceMetadataClient createForRuntime(
    @NonNull Context context,
    @NonNull ComponentName watchFaceName,
    @NonNull String runtimePackage
)

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
@NonNull Context context

Calling application's Context.

@NonNull ComponentName watchFaceName

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

@NonNull String runtimePackage

The package that contains the Resource only Watch Face runtime.

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.