Skip to content

Most visited

Recently visited

navigation

ProviderInfoRetriever

public class ProviderInfoRetriever
extends Object

java.lang.Object
   ↳ android.support.wearable.complications.ProviderInfoRetriever


Retrieves ComplicationProviderInfo for a watch face's complications.

To use, construct an instance providing an Executor (that should be for a background thread), and then call init(). Then retrieveProviderInfo(ProviderInfoRetriever.OnProviderInfoReceivedCallback, ComponentName, int...) may be called. The retrieval will be performed using the provided executor, and the provided ProviderInfoRetriever.OnProviderInfoReceivedCallback will be called when complete.

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

Summary

Nested classes

class ProviderInfoRetriever.OnProviderInfoReceivedCallback

Interface for a callback to be invoked when provider info is received. 

Public constructors

ProviderInfoRetriever(Context context, Executor executor)

Public methods

void init()

Initiates the connection between this class and the complications system.

void release()

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

void retrieveProviderInfo(ProviderInfoRetriever.OnProviderInfoReceivedCallback callback, ComponentName watchFaceComponent, int... watchFaceComplicationIds)

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

Inherited methods

From class java.lang.Object

Public constructors

ProviderInfoRetriever

ProviderInfoRetriever (Context context, 
                Executor executor)

Parameters
context Context: the current context

executor Executor: used to retrieve the provider info. This executor should run tasks on a background thread.

Public methods

init

void init ()

Initiates the connection between this class and the complications system. This must be called before retrieveProviderInfo(ProviderInfoRetriever.OnProviderInfoReceivedCallback, ComponentName, int...) will work.

release

void release ()

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

Any outstanding retrievals will fail, resulting in calls to onRetrievalFailed. Any subsequent calls to retrieveProviderInfo(ProviderInfoRetriever.OnProviderInfoReceivedCallback, ComponentName, int...) will also result in failure.

retrieveProviderInfo

void retrieveProviderInfo (ProviderInfoRetriever.OnProviderInfoReceivedCallback callback, 
                ComponentName watchFaceComponent, 
                int... watchFaceComplicationIds)

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
callback ProviderInfoRetriever.OnProviderInfoReceivedCallback: that will be called with the requested provider info once it has been retrieved

watchFaceComponent ComponentName: the ComponentName of the WatchFaceService for which info is being requested

watchFaceComplicationIds int: ids of the complications that info is being requested for

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)