WatchFaceMetadataClient.Companion


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.