added in version 27.1.0
belongs to Maven artifact
Deprecated since version 27.1.0


public final class AmbientMode
extends Fragment


This class was deprecated in API level 27.1.0.
please use AmbientModeSupport instead.

Use this as a headless Fragment to add ambient support to an Activity on Wearable devices.

The application that uses this should add the WAKE_LOCK permission to its manifest.

The primary entry point for this code is the attachAmbientSupport(Activity) method. It should be called with an Activity as an argument and that Activity will then be able to receive ambient lifecycle events through an AmbientMode.AmbientCallback. The Activity will also receive a AmbientMode.AmbientController object from the attachment which can be used to query the current status of the ambient mode. An example of how to attach AmbientMode to your Activity and use the AmbientMode.AmbientController can be found below:

AmbientMode.AmbientController controller = AmbientMode.attachAmbientSupport(this);
     boolean isAmbient =  controller.isAmbient();


Nested classes

class AmbientMode.AmbientCallback

Callback to receive ambient mode state changes. 

interface AmbientMode.AmbientCallbackProvider

Interface for any Activity that wishes to implement Ambient Mode. 

class AmbientMode.AmbientController

A class for interacting with the ambient mode on a wearable device. 



Property in bundle passed to AmbientCallback#onEnterAmbient(Bundle) to indicate whether burn-in protection is required.


Property in bundle passed to AmbientCallback#onEnterAmbient(Bundle) to indicate whether the device has low-bit ambient mode.


Fragment tag used by default when adding AmbientMode to add ambient support to an Activity.

Inherited constants

From interface android.content.ComponentCallbacks2

Public constructors



Public methods

static <T extends Activity> AmbientMode.AmbientController attachAmbientSupport(T activity)

Attach ambient support to the given activity.

void dump(String prefix, FileDescriptor fd, PrintWriter writ