Google is committed to advancing racial equity for Black communities. See how.

ProviderInfoRetriever

open class ProviderInfoRetriever : AutoCloseable
kotlin.Any
   ↳ androidx.wear.complications.ProviderInfoRetriever

Retrieves ComplicationProviderInfo for a watch face's complications.

To use construct an instance and call retrieveProviderInfo which returns a .

Further calls to retrieveProviderInfo may be made using the same instance of this class, but close must be called when it is no longer needed. Once release has been called, further retrieval attempts will fail.

Summary

Nested classes
open

Results for retrieveProviderInfo.

Public constructors
<init>(@NonNull context: Context)

Public methods
open Unit

Releases the connection to the complication system used by this class.

open ListenableFuture<ProviderInfoRetriever.ProviderInfo!>
retrieveProviderInfo(@NonNull watchFaceComponent: ComponentName, @NonNull watchFaceComplicationIds: IntArray)

Requests ComplicationProviderInfo for the specified complication ids on the specified watch face.

Public constructors

<init>

ProviderInfoRetriever(@NonNull context: Context)
Parameters
context Context: the current context

Public methods

close

open fun close(): Unit

Releases the connection to the complication system used by this class. This must be called when the retriever is no longer needed.

Any outstanding or subsequent futures returned by retrieveProviderInfo will resolve with null. This class implements the Java AutoClosable interface and may be used with try-with-resources.

retrieveProviderInfo

@NonNull open fun retrieveProviderInfo(
    @NonNull watchFaceComponent: ComponentName,
    @NonNull watchFaceComplicationIds: IntArray
): ListenableFuture<ProviderInfoRetriever.ProviderInfo!>

Requests ComplicationProviderInfo for the specified complication ids on the specified watch face. When the info is received, the listener will receive a callback for each id. These callbacks will occur on the main thread.

This will only work if the package of the current app is the same as the package of the specified watch face.

Parameters
watchFaceComponent ComponentName: the ComponentName of the WatchFaceService for which info is being requested
watchFaceComplicationIds IntArray: ids of the complications that info is being requested for
Return
ListenableFuture<ProviderInfoRetriever.ProviderInfo!> A ListenableFuture for the requested provider info. If the look up fails null will be returned