public abstract class

WearableActivity

extends Activity

Note: The Wearable Support Library classes under the android.support.wearable package are subject to change. For the full Android API reference, see Reference.

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
         ↳ android.app.Activity
           ↳ android.support.wearable.activity.WearableActivity

Class Overview

Base activity class for use on wearables. Provides compatibility for Ambient mode support.

If this library is passed through proguard optimization, make sure to add the com.google.android.wearable:wearable jar to the list of proguard library jars. Using gradle this can be accomplished by adding the following dependency line:

 dependencies {
     provided 'com.google.android.wearable:wearable:1.0+'
 }

Summary

Constants
String EXTRA_BURN_IN_PROTECTION Property in bundle passed to onEnterAmbient(Bundle) and onUpdateAmbient() to indicate whether burn-in protection is required.
String EXTRA_LOWBIT_AMBIENT Property in bundle passed to onEnterAmbient(Bundle) and onUpdateAmbient() to indicate whether the device has low-bit ambient mode.
[Expand]
Inherited Constants
From class android.app.Activity
From class android.content.Context
From interface android.content.ComponentCallbacks2
[Expand]
Inherited Fields
From class android.app.Activity
Public Constructors
WearableActivity()
Public Methods
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)
final boolean isAmbient()
void onEnterAmbient(Bundle ambientDetails)
Called when an activity is entering ambient mode.
void onExitAmbient()
Called when an activity should exit ambient mode.
void onUpdateAmbient()
Called when the system is updating the display for ambient mode.
final void setAmbientEnabled()
Sets that this activity should remain displayed when the system enters ambient mode.
Protected Methods
void onCreate(Bundle savedInstanceState)
void onDestroy()
void onPause()
void onResume()
void onStop()
[Expand]
Inherited Methods
From class android.app.Activity
From class android.view.ContextThemeWrapper
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.view.LayoutInflater.Factory2
From interface android.view.Window.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.View.OnCreateContextMenuListener
From interface android.content.ComponentCallbacks2
From interface android.view.LayoutInflater.Factory
From interface android.content.ComponentCallbacks

Constants

public static final String EXTRA_BURN_IN_PROTECTION

Property in bundle passed to onEnterAmbient(Bundle) and onUpdateAmbient() to indicate whether burn-in protection is required. When this property is set to true, views must be shifted around periodically in ambient mode. To ensure that content isn't shifted off the screen, avoid placing content within 10 pixels of the edge of the screen. Activities should also avoid solid white areas to prevent pixel burn-in. Both of these requirements only apply in ambient mode, and only when this property is set to true.

Constant Value: "com.google.android.wearable.compat.extra.BURN_IN_PROTECTION"

public static final String EXTRA_LOWBIT_AMBIENT

Property in bundle passed to onEnterAmbient(Bundle) and onUpdateAmbient() to indicate whether the device has low-bit ambient mode. When this property is set to true, the screen supports fewer bits for each color in ambient mode. In this case, activities should disable anti-aliasing in ambient mode.

Constant Value: "com.google.android.wearable.compat.extra.LOWBIT_AMBIENT"

Public Constructors

public WearableActivity ()

Public Methods

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

public final boolean isAmbient ()

Returns
  • true if the activity is currently in ambient.

public void onEnterAmbient (Bundle ambientDetails)

Called when an activity is entering ambient mode. This event is sent while an activity is running (after onResume, before onPause). All drawing should complete by the conclusion of this method. Note that invalidate() calls will be executed before resuming lower-power mode.

Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.

Parameters
ambientDetails bundle containing information about the display being used. It includes information about low-bit color and burn-in protection.

public void onExitAmbient ()

Called when an activity should exit ambient mode. This event is sent while an activity is running (after onResume, before onPause).

Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.

public void onUpdateAmbient ()

Called when the system is updating the display for ambient mode. Activities may use this opportunity to update or invalidate views.

public final void setAmbientEnabled ()

Sets that this activity should remain displayed when the system enters ambient mode. The default is false. In this case, the activity is stopped when the system enters ambient mode.

Protected Methods

protected void onCreate (Bundle savedInstanceState)

protected void onDestroy ()

protected void onPause ()

protected void onResume ()

protected void onStop ()