Added in version 33.1

AmbientComponentState.ActivityStateRegistry

public static final class AmbientComponentState.ActivityStateRegistry
extends Object

java.lang.Object
   ↳ com.google.wear.services.ambient.AmbientComponentState.ActivityStateRegistry


A state registry specifically intended for app components that subscribe to the standard Android lifecycle. Components provide the AmbientManager with their lifecycle updates via the appropriate callbacks. The critical states for ambient mode correspond to the Android lifecycle stats of RESUMED and PAUSED as it is only between these two states that a component is eligible for ambient display.

Apps can provide this integration following this example:

     @Override
     void onCreate() {
         mMyActivityStateRegistry = AmbientComponentState.makeActivityRegistry();
     }

     @Override
     void onResume() {
         mMyActivityStateRegistry.onResume();
     }

     @Override
     void onPause() {
         mMyActivityStateRegistry.onPause();
     }

 

Summary

Public methods

void onPause()

Indicate that this component is paused, thereby disabling eligibility for ambient events.

void onResume()

Indicate that this component is resumed, thereby enabing eligibility for ambient events.

Inherited methods

Public methods

onPause

Added in version 33.1
public void onPause ()

Indicate that this component is paused, thereby disabling eligibility for ambient events.

onResume

Added in version 33.1
public void onResume ()

Indicate that this component is resumed, thereby enabing eligibility for ambient events.