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:

{@code * 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 {@code AmbientCallback#onEnterAmbient(Bundle)} to indicate whether burn-in protection is required.

static final @NonNull String

Property in bundle passed to {@code 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 Array<@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 Fragment

This method is deprecated.

@NonNull Transition

This method is deprecated.

final @NonNull Resources

This method is deprecated.

final @NonNull boolean

This method is deprecated.

@NonNull Transition

This method is deprecated.

@NonNull Transition

This method is deprecated.

@NonNull Transition

This method is deprecated.

final @NonNull String
getString(@NonNull int resId)

This method is deprecated.

final @NonNull String

This method is deprecated.

final @NonNull Fragment

This method is deprecated.

final @NonNull int

This method is deprecated.

final @NonNull CharSequence
getText(@NonNull int resId)

This method is deprecated.

@NonNull boolean

This method is deprecated.

@NonNull View

This method is deprecated.

final @NonNull int

This method is deprecated.

static @NonNull Fragment

This method is deprecated.

final @NonNull boolean

This method is deprecated.

final @NonNull boolean

This method is deprecated.

final @NonNull boolean

This method is deprecated.

final @NonNull boolean

This method is deprecated.

final @NonNull boolean

This method is deprecated.

final @NonNull boolean

This method is deprecated.

final @NonNull boolean

This method is deprecated.

final @NonNull boolean

This method is deprecated.

@NonNull void
onActivityCreated(@NonNull Bundle savedInstanceState)

This method is deprecated.

@NonNull void
onActivityResult(
    @NonNull int requestCode,
    @NonNull int resultCode,
    @NonNull Intent data
)

This method is deprecated.

@NonNull void

This method is deprecated.

@NonNull void

This method is deprecated.

@NonNull boolean

This method is deprecated.

@NonNull Animator
onCreateAnimator(
    @NonNull int transit,
    @NonNull boolean enter,
    @NonNull int nextAnim
)

This method is deprecated.

@NonNull void

This method is deprecated.

@NonNull void

This method is deprecated.

@NonNull View
onCreateView(
    @NonNull LayoutInflater inflater,
    @NonNull ViewGroup container,
    @NonNull Bundle savedInstanceState
)

This method is deprecated.

@NonNull void

This method is deprecated.

@NonNull void

This method is deprecated.

@NonNull LayoutInflater
onGetLayoutInflater(@NonNull Bundle savedInstanceState)

This method is deprecated.

@NonNull void
onHiddenChanged(@NonNull boolean hidden)

This method is deprecated.

@NonNull void
onInflate(@NonNull AttributeSet attrs, @NonNull Bundle savedInstanceState)

This method is deprecated.

@NonNull void

This method is deprecated.

@NonNull void
onMultiWindowModeChanged(
    @NonNull boolean isInMultiWindowMode,
    @NonNull Configuration newConfig
)

This method is deprecated.

@NonNull boolean

This method is deprecated.

@NonNull void

This method is deprecated.

@NonNull void
onPictureInPictureModeChanged(
    @NonNull boolean isInPictureInPictureMode,
    @NonNull Configuration newConfig
)

This method is deprecated.