WearableActivity
  public
  
  
  abstract
  class
  WearableActivity
  
  
  
  
  
  
  
  
  
  
  
  
  
    extends Activity
  
  
  
  
  
  
| java.lang.Object | |||||
| ↳ | android.content.Context | ||||
| ↳ | android.content.ContextWrapper | ||||
| ↳ | android.view.ContextThemeWrapper | ||||
| ↳ | android.app.Activity | ||||
| ↳ | android.support.wearable.activity.WearableActivity | ||||
      This class is deprecated.
    use the androidx.wear.ambient.AmbientModeSupport provided by the Jetpack Wear library instead.
  
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_PROTECTIONProperty in bundle passed to  | 
| String | EXTRA_LOWBIT_AMBIENTProperty in bundle passed to  | 
| Inherited constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 
      From class
         android.app.Activity
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
      From class
         android.content.Context
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
      From interface
         android.content.ComponentCallbacks2
 | 
| 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. | 
| 
        
        
        
        final
        
        void | 
      setAutoResumeEnabled(boolean enabled)
      Sets whether this activity's task should be moved to the front when the system exits ambient mode. | 
| Protected methods | |
|---|---|
| 
        
        
        
        
        
        void | 
      onCreate(Bundle savedInstanceState)
       | 
| 
        
        
        
        
        
        void | 
      onDestroy()
       | 
| 
        
        
        
        
        
        void | 
      onPause()
       | 
| 
        
        
        
        
        
        void | 
      onResume()
       | 
| 
        
        
        
        
        
        void | 
      onStop()
       | 
| 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.OnBackInvokedDispatcherOwner
        
      
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
    From interface
       
        
          android.view.LayoutInflater.Factory
        
      
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
    From interface
       
        
          android.content.ComponentCallbacks
        
      
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constants
EXTRA_BURN_IN_PROTECTION
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"
EXTRA_LOWBIT_AMBIENT
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
WearableActivity
public WearableActivity ()
Public methods
dump
public void dump (String prefix, FileDescriptor fd, PrintWriter writer, String[] args)
| Parameters | |
|---|---|
| prefix | String | 
| fd | FileDescriptor | 
| writer | PrintWriter | 
| args | String | 
isAmbient
public final boolean isAmbient ()
| Returns | |
|---|---|
| boolean | trueif the activity is currently in ambient. | 
onEnterAmbient
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: bundle containing information about the display being used. It includes
     information about low-bit color and burn-in protection. | 
onExitAmbient
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.
onUpdateAmbient
public void onUpdateAmbient ()
Called when the system is updating the display for ambient mode. Activities may use this opportunity to update or invalidate views.
setAmbientEnabled
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.
setAutoResumeEnabled
public final void setAutoResumeEnabled (boolean enabled)
Sets whether this activity's task should be moved to the front when the system exits ambient mode. If true, the activity's task may be moved to the front if it was the last activity to be running when ambient started, depending on how much time the system spent in ambient mode.
| Parameters | |
|---|---|
| enabled | boolean | 
Protected methods
onDestroy
protected void onDestroy ()
onPause
protected void onPause ()
onResume
protected void onResume ()
onStop
protected void onStop ()
