Added in [version 33.1](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Methods](https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager.Controller#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager.Controller#inhmethods)

# AmbientManager.Controller


`
public
static
final

class
AmbientManager.Controller
`


`

extends Object


`

`


`

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

<br />

*** ** * ** ***

A controller provided by the Wear OS `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager` for use in controlling a component's
behavior while in ambient mode. The component obtains this object via `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager#createController(android.content.Context,%20com.google.wear.services.ambient.AmbientOptions)` and can subsequently modify the
behavior/enablement of ambient mode using the provided API.

## Summary

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager.Controller#destroy()() ` Components should call this method when they no longer require ambient support. |
| ` int` | ` https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager.Controller#getAmbientSupportLevel()() ` |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager.Controller#isAmbientSupportEnabled()() ` |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager.Controller#isAutoResumeEnabled()() ` |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager.Controller#isComponentInAmbient()() ` Check if the component is currently in ambient mode. |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager.Controller#isSystemInAmbient()() ` Check if the system is currently in ambient mode. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager.Controller#setAmbientSupportLevel(int)(int supportLevel) ` Sets the ambient support level provided by the component. |

| ### Inherited methods |
|---|---|
| From class ` java.lang.Object ` |---|---| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class<?>` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||

## Public methods

### destroy

Added in [version 33.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
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 `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientManager#createController(android.content.Context,%20com.google.wear.services.ambient.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.

<br />

### getAmbientSupportLevel

Added in [version 33.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int getAmbientSupportLevel ()
```

<br />

<br />

| Returns ||
|---|---|
| `int` | the current ambient support level, as defined by `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions`. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions#AMBIENT_SUPPORT_TAKEOVER_DISPLAY` - `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions#AMBIENT_SUPPORT_AUTORESUME_ONLY` - `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions#AMBIENT_SUPPORT_NONE` |

### isAmbientSupportEnabled

Added in [version 33.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean isAmbientSupportEnabled ()
```

<br />

<br />

| 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). <br /> |

### isAutoResumeEnabled

Added in [version 33.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean isAutoResumeEnabled ()
```

<br />

<br />

| Returns ||
|---|---|
| `boolean` | `true` if the component has indicated it should auto-resume in the absence of full ambient mode support. <br /> |

### isComponentInAmbient

Added in [version 33.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
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.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if the component is in ambient mode, otherwise `false`. <br /> |

### isSystemInAmbient

Added in [version 33.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
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.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if the system is in ambient mode, otherwise `false`. <br /> |

### setAmbientSupportLevel

Added in [version 33.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void setAmbientSupportLevel (int supportLevel)
```

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

- `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions#AMBIENT_SUPPORT_TAKEOVER_DISPLAY`
- `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions#AMBIENT_SUPPORT_AUTORESUME_ONLY`
- `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions#AMBIENT_SUPPORT_NONE`

<br />

<br />

| 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: - `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions#AMBIENT_SUPPORT_TAKEOVER_DISPLAY` - `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions#AMBIENT_SUPPORT_AUTORESUME_ONLY` - `https://developer.android.com/reference/com/google/wear/services/ambient/AmbientOptions#AMBIENT_SUPPORT_NONE` |