AmbientMode

public final class AmbientMode


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 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 AmbientCallback. The Activity will also receive a 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 AmbientController can be found below:

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

Summary

Nested types

AmbientMode.AmbientCallback

Callback to receive ambient mode state changes.

AmbientMode.AmbientCallbackProvider

Interface for any Activity that wishes to implement Ambient Mode.

AmbientMode.AmbientController

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

Constants

static final String

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

static final String

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

static final String

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

Public constructors

Constructor

Public methods

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

Attach ambient support to the given activity.

@Override void
dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

This method is deprecated.

@Override @CallSuper void
onAttach(Context context)

This method is deprecated.

@Override @CallSuper void
onCreate(Bundle savedInstanceState)

This method is deprecated.

@Override @CallSuper void

This method is deprecated.

@Override @CallSuper void

This method is deprecated.

@Override @CallSuper void

This method is deprecated.

@Override @CallSuper void

This method is deprecated.

@Override @CallSuper void

This method is deprecated.

Inherited methods

From class Fragment
final boolean

This method is deprecated.

final Activity

This method is deprecated.

boolean

This method is deprecated.

boolean

This method is deprecated.

final Bundle

This method is deprecated.

final FragmentManager

This method is deprecated.

Context

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

final FragmentManager

This method is deprecated.

final Object

This method is deprecated.

final int

This method is deprecated.

final LayoutInflater

This method is deprecated.

LoaderManager

This method is deprecated.

final Fragment