ProviderInfoRetriever

public class ProviderInfoRetriever
extends Object

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


This class is deprecated.
use the Jetpack Wear Watch Face libraries instead.

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

This class is deprecated. use the Jetpack Wear Watch Face libraries instead.  

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

Public constructors

ProviderInfoRetriever

public 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

public 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

public 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

public 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