belongs to Maven artifact com.android.support:wear:28.0.0-alpha1
Deprecated since version 27.1.0
AmbientMode
public
final
class
AmbientMode
extends Fragment
java.lang.Object | ||
↳ | android.app.Fragment | |
↳ | android.support.wear.ambient.AmbientMode |
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();
Summary
Nested classes | |
---|---|
class |
AmbientMode.AmbientCallback
Callback to receive ambient mode state changes. |
interface |
AmbientMode.AmbientCallbackProvider
Interface for any |
class |
AmbientMode.AmbientController
A class for interacting with the ambient mode on a wearable device. |
Constants | |
---|---|
String |
EXTRA_BURN_IN_PROTECTION
Property in bundle passed to |
String |
EXTRA_LOWBIT_AMBIENT
Property in bundle passed to |
String |
FRAGMENT_TAG
Fragment tag used by default when adding |
Inherited constants |
---|
![]()
android.content.ComponentCallbacks2
|
Public constructors | |
---|---|
AmbientMode()
Constructor |
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 writer, String[] args)
|
void
|
onAttach(Context context)
|
void
|
onCreate(Bundle savedInstanceState)
|
void
|
onDestroy()
|
void
|
onDetach()
|
void
|
onPause()
|
void
|
onResume()
|
void
|
|