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 @NonNull String

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

static final @NonNull String

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

static final @NonNull String

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

Public constructors

Constructor

Public methods

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

Attach ambient support to the given activity.

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

This method is deprecated.

@Override @CallSuper @NonNull void

This method is deprecated.

@Override @CallSuper @NonNull void
onCreate(@NonNull Bundle savedInstanceState)

This method is deprecated.

@Override @CallSuper @NonNull void

This method is deprecated.

@Override @CallSuper @NonNull void

This method is deprecated.

@Override @CallSuper @NonNull void

This method is deprecated.

@Override @CallSuper @NonNull void

This method is deprecated.

@Override @CallSuper @NonNull void

This method is deprecated.

Inherited methods

From class Fragment
final @NonNull boolean

This method is deprecated.

final @NonNull Activity

This method is deprecated.

@NonNull boolean

This method is deprecated.

@NonNull boolean

This method is deprecated.

final @NonNull Bundle

This method is deprecated.

final @NonNull FragmentManager

This method is deprecated.

@NonNull Context

This method is deprecated.

@NonNull Transition

This method is deprecated.

@NonNull Transition

This method is deprecated.

final @NonNull FragmentManager

This method is deprecated.

final @NonNull Object

This method is deprecated.

final @NonNull int

This method is deprecated.

final @NonNull LayoutInflater

This method is deprecated.

@NonNull LoaderManager

This method is deprecated.

final @NonNull