AmbientLifecycleObserver.AmbientLifecycleCallback

Added in 1.3.0

interface AmbientLifecycleObserver.AmbientLifecycleCallback


Callback to receive ambient mode state changes.

Summary

Public functions

open Unit

Called when an activity is entering ambient mode.

open Unit

Called when an activity should exit ambient mode.

open Unit

Called when the system is updating the display for ambient mode.

Public functions

onEnterAmbient

Added in 1.3.0
open fun onEnterAmbient(ambientDetails: AmbientLifecycleObserver.AmbientDetails): Unit

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 {@code invalidate()} calls will be executed before resuming lower-power mode.

Parameters
ambientDetails: AmbientLifecycleObserver.AmbientDetails

instance of AmbientDetails containing information about the display being used.

onExitAmbient

Added in 1.3.0
open fun onExitAmbient(): Unit

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

onUpdateAmbient

Added in 1.3.0
open fun onUpdateAmbient(): Unit

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