Added in version 33.1

AmbientManager.Controller

public static final class AmbientManager.Controller
extends Object

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


A controller provided by the Wear OS AmbientManager for use in controlling a component's behavior while in ambient mode. The component obtains this object via AmbientManager.createController(Context,AmbientOptions) and can subsequently modify the behavior/enablement of ambient mode using the provided API.

Summary

Public methods

void destroy()

Components should call this method when they no longer require ambient support.

int getAmbientSupportLevel()
boolean isAmbientSupportEnabled()
boolean isAutoResumeEnabled()
boolean isComponentInAmbient()

Check if the component is currently in ambient mode.

boolean isSystemInAmbient()

Check if the system is currently in ambient mode.

void setAmbientSupportLevel(int supportLevel)

Sets the ambient support level provided by the component.

Inherited methods

Public methods

destroy

Added in version 33.1
public void destroy ()

Components should call this method when they no longer require ambient support. Typically this should be done in symmetric fashion with respect to AmbientManager.createController(Context,AmbientOptions) ()}. For example:

     public void onCreate() {
         final AmbientManager ambientManager = ... // fetch from Sdk
         mAmbientController = ambientManager.createController(...);  // returns Controller
     }

     public void onDestroy() {
         mAmbientController.destroy();
     }
 

Note that upon calling this method, components will no longer receive any ambient callbacks. In order to reinstitute ambient support, components will need to createController() again.

getAmbientSupportLevel

Added in version 33.1
public int getAmbientSupportLevel ()

Returns
int the current ambient support level, as defined by AmbientOptions.AmbientSupportLevel.
Value is one of the following:

isAmbientSupportEnabled

Added in version 33.1
public boolean isAmbientSupportEnabled ()

Returns
boolean true if the component has indicated it supports full ambient mode (i.e. provides a UI suitable for display in low-power mode).

isAutoResumeEnabled

Added in version 33.1
public boolean isAutoResumeEnabled ()

Returns
boolean true if the component has indicated it should auto-resume in the absence of full ambient mode support.

isComponentInAmbient

Added in version 33.1
public boolean isComponentInAmbient ()

Check if the component is currently in ambient mode. Note that the component must have ambient mode supported in order to enter ambient mode.

Returns
boolean true if the component is in ambient mode, otherwise false.

isSystemInAmbient

Added in version 33.1
public boolean isSystemInAmbient ()

Check if the system is currently in ambient mode. Note that this will track the state of the system regardless of whether or not the component actually declares that they support ambient.

Returns
boolean true if the system is in ambient mode, otherwise false.

setAmbientSupportLevel

Added in version 33.1
public void setAmbientSupportLevel (int supportLevel)

Sets the ambient support level provided by the component. Must be one of:

Parameters
supportLevel int: the level of ambient support provided by the component. Components wishing to take over the display must provide a separate UI that is suitable for display in low power mode. Those using auto-resume won't provide any ambient UI, but their task will be automatically moved to the foreground if the time in ambient mode is short lived. Components offering no support will effectively be moved to the background and remain there during and upon exit from ambient mode.
Value is one of the following: