ComplicationsManager
public
final
class
ComplicationsManager
extends Object
| java.lang.Object | |
| ↳ | com.google.wear.services.complications.ComplicationsManager |
Provides access to various complications methods.
Summary
Public methods | |
|---|---|
void
|
getActiveComplicationConfigsAsync(Executor executor, OutcomeReceiver<List<ActiveComplicationConfig>, Throwable> outcomeReceiver)
Returns information about active complications belonging to the calling complication provider app asynchronously. |
void
|
updateComplication(int complicationInstanceId, ComplicationData complicationData, Executor executor, OutcomeReceiver<Void, Throwable> outcomeReceiver)
Sends the provided ComplicationData to the active watchface. |
Inherited methods | |
|---|---|
Public methods
getActiveComplicationConfigsAsync
public void getActiveComplicationConfigsAsync (Executor executor,
OutcomeReceiver<List<ActiveComplicationConfig>, Throwable> outcomeReceiver)Returns information about active complications belonging to the calling complication provider app asynchronously.
If the calling app does not have any active complications, then an empty list is returned.
The caller should provide an executor on which the call and the outcome will be processed.
| Parameters | |
|---|---|
executor |
Executor: the executor which will be used to make the call and process the result. |
outcomeReceiver |
OutcomeReceiver: an OutcomeReceiver that can handle a result of type List<ActiveComplication>. A RemoteException may be thrown if communication with the
backend encounters an error. |
updateComplication
public void updateComplication (int complicationInstanceId,
ComplicationData complicationData,
Executor executor,
OutcomeReceiver<Void, Throwable> outcomeReceiver)Sends the provided ComplicationData to the active watchface.
Before forwarding the data, the system will do some checks to ensure that the complicationInstanceId corresponds to an actual active complication on the currently active watchface. Also, the system will ensure that the caller actually owns the complication.
| Parameters | |
|---|---|
complicationInstanceId |
int: the system's id for an active ComplicationConfig on the
currently active watch face. The tuple [Active Watch face ComponentName, complication
slot ID] will have a unique "active" complicationInstanceId. A watch face may be unset,
and reset as active, in which case the old value will not be valid and a new id is
assigned by the system. Use getActiveComplicationConfigsAsync(Executor, OutcomeReceiver) to receive a list
of complication configs that are currently active on the active watch face. |
complicationData |
ComplicationData: the new data that the complication should show on the watch face. |
executor |
Executor: the executor which will be used to make the call and process the result. |
outcomeReceiver |
OutcomeReceiver: an OutcomeReceiver that will receive a void result when the data was
processed successfully. It is not an indication of whether the data was delivered to the
watch face, just that it was processed and forwarded without error. A throwable is
received if communication with the system encounters an error or if there was an error
while processing the complication data. |