AmbientManager

public class AmbientManager
extends Object

java.lang.Object
   ↳ com.google.wear.services.ambient.AmbientManager


Provides APIs via the Wear OS SDK for components to integrate with ambient mode support on Wear OS.

An instance of this class can be obtained directly via the Wear OS SDK by invoking the following API:

com.google.wear.Sdk.getWearManager(context, AmbientManager.class);

The first step in using AmbientManager to implement ambient mode support to call AmbientManager.createController(Context,AmbientOptions) to register the manager, ensuring that you receive the expected callbacks etc.

Registration requires your context as well as an AmbientOptions instance. Successful registration will return an AmbientManager.Controller instance, which will serve as the client's interface to the ambient system for as long as the component/manager exist or until Controller.destroy() is called.

AmbientManager.Controller provides additional API to control the component's behavior in ambient mode via AmbientManager.Controller.setAmbientSupportLevel(int). Note that the controller enables ambient mode support by default at the time of registration.

Summary

Nested classes

interface AmbientManager.AmbientComponentListener

The callbacks that an ambient component must implement and provide to the AmbientManager at the time of registration via AmbientOptions i.e. 

interface AmbientManager.AmbientTransitionFinishedNotifier

Transition callback provided to the component in#onStartAmbientTransition(TransitionDetails, AmbientTransitionFinishedNotifier) allowing it to signal early completion of the ambient entry or exit transition. 

interface AmbientManager.AmbientTransitionListener

The callbacks that an ambient component must implement and provide to the AmbientManager at the time of registration i.e. 

interface AmbientManager.ConfigurationDetails

Details provided to AmbientComponentListener.onEnterAmbient(ConfigurationDetails)

class AmbientManager.Controller

A controller provided by the Wear OS AmbientManager for use in controlling a component's behavior while in ambient mode. 

interface AmbientManager.TransitionDetails

Details provided to AmbientTransitionListener.onStartAmbientTransition(TransitionDetails,AmbientTransitionFinishedNotifier)

Public methods

AmbientManager.Controller createController(Context context, AmbientOptions options)

The main entry point for components to use when implementing support for ambient mode.

Inherited methods

Public methods

createController

Added in version 33.1
public AmbientManager.Controller createController (Context context, 
                AmbientOptions options)

The main entry point for components to use when implementing support for ambient mode. Once the component has obtained their instance of AmbientManager and initialized the AmbientOptions required for registration they can call this method.

This method returns an instance of AmbientManager.Controller which is effectively ready to support ambient mode. Note that ambient support is enabled by default - components should call Controller.setAmbientSupportLevel(int) with to change the default behaviour.

Parameters
context Context: the Context associated with the ambient component.

options AmbientOptions: the AmbientOptions created specifically for this ambient component on the basis of type (e.g. app component vs watchface).

Returns
AmbientManager.Controller an instance of AmbientManager.Controller capable of controlling the component's behavior while in ambient mode.