# AmbientLifecycleObserver.AmbientLifecycleCallback

Artifact: [androidx.wear:wear](https://developer.android.com/jetpack/androidx/releases/wear) [View Source](https://cs.android.com/search?q=file:androidx/wear/ambient/AmbientLifecycleObserver.kt+class:androidx.wear.ambient.AmbientLifecycleObserver.AmbientLifecycleCallback) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear#1.3.0)

*** ** * ** ***


```
public interface AmbientLifecycleObserver.AmbientLifecycleCallback
```

<br />

*** ** * ** ***

Callback to receive ambient mode state changes.

## Summary

| ### Public methods |
|---|---|
| `default void` | `https://developer.android.com/reference/androidx/wear/ambient/AmbientLifecycleObserver.AmbientLifecycleCallback#onEnterAmbient(androidx.wear.ambient.AmbientLifecycleObserver.AmbientDetails)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/ambient/AmbientLifecycleObserver.AmbientDetails ambientDetails )` Called when an activity is entering ambient mode. |
| `default void` | `https://developer.android.com/reference/androidx/wear/ambient/AmbientLifecycleObserver.AmbientLifecycleCallback#onExitAmbient()()` Called when an activity should exit ambient mode. |
| `default void` | `https://developer.android.com/reference/androidx/wear/ambient/AmbientLifecycleObserver.AmbientLifecycleCallback#onUpdateAmbient()()` Called when the system is updating the display for ambient mode. |

## Public methods

### onEnterAmbient

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear#1.3.0)

```
default void onEnterAmbient(
    @NonNull AmbientLifecycleObserver.AmbientDetails 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 {@code invalidate()} calls will be executed before resuming lower-power mode.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/ambient/AmbientLifecycleObserver.AmbientDetails ambientDetails` | instance of `https://developer.android.com/reference/androidx/wear/ambient/AmbientLifecycleObserver.AmbientDetails` containing information about the display being used. |

### onExitAmbient

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/wear#1.3.0)

```
default void onExitAmbient()
```

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](https://developer.android.com/jetpack/androidx/releases/wear#1.3.0)

```
default void onUpdateAmbient()
```

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