# AmbientLifecycleObserver.AmbientLifecycleCallback

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/ambient/AmbientLifecycleObserver.AmbientLifecycleCallback "View this page in Java")

<br />

```
interface AmbientLifecycleObserver.AmbientLifecycleCallback
```

<br />

*** ** * ** ***

Callback to receive ambient mode state changes.

## Summary

|                                 ### Public functions                                 |
|--------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `open `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onEnterAmbient](https://developer.android.com/reference/kotlin/androidx/wear/ambient/AmbientLifecycleObserver.AmbientLifecycleCallback#onEnterAmbient(androidx.wear.ambient.AmbientLifecycleObserver.AmbientDetails))`(ambientDetails: `[AmbientLifecycleObserver.AmbientDetails](https://developer.android.com/reference/kotlin/androidx/wear/ambient/AmbientLifecycleObserver.AmbientDetails)`)` Called when an activity is entering ambient mode. |
| `open `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onExitAmbient](https://developer.android.com/reference/kotlin/androidx/wear/ambient/AmbientLifecycleObserver.AmbientLifecycleCallback#onExitAmbient())`()` Called when an activity should exit ambient mode.                                                                                                                                                                                                                                         |
| `open `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onUpdateAmbient](https://developer.android.com/reference/kotlin/androidx/wear/ambient/AmbientLifecycleObserver.AmbientLifecycleCallback#onUpdateAmbient())`()` Called when the system is updating the display for ambient mode.                                                                                                                                                                                                                      |

## Public functions

### onEnterAmbient

Added in[1.3.0](https://developer.android.com/jetpack/androidx/releases/wear#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](https://developer.android.com/reference/kotlin/androidx/wear/ambient/AmbientLifecycleObserver.AmbientDetails) | instance of[AmbientDetails](https://developer.android.com/reference/kotlin/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)  

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