# DefaultLifecycleObserver

Artifact: [androidx.lifecycle:lifecycle-common](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/DefaultLifecycleObserver.kt+class:androidx.lifecycle.DefaultLifecycleObserver) Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0)

*** ** * ** ***

Common/AllAndroid/JVM
- Cmn

  ```
  interface DefaultLifecycleObserver : LifecycleObserver
  ```
Known direct subclasses [AmbientLifecycleObserver](https://developer.android.com/reference/kotlin/androidx/wear/ambient/AmbientLifecycleObserver)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/ambient/AmbientLifecycleObserver` | Interface for LifecycleObservers which are used to add ambient mode support to activities on Wearable devices. |

*** ** * ** ***

Callback interface for listening to `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` state changes.

If a class implements both this interface and `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleEventObserver`, the methods of `https://developer.android.com/reference/kotlin/androidx/lifecycle/DefaultLifecycleObserver` are called first, followed by `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleEventObserver#onStateChanged(androidx.lifecycle.LifecycleOwner,androidx.lifecycle.Lifecycle.Event)`.

Note: If a class implements this interface and also uses the deprecated `androidx.lifecycle.OnLifecycleEvent` annotations, those annotations are ignored.

## Summary

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/lifecycle/DefaultLifecycleObserver#onCreate(androidx.lifecycle.LifecycleOwner)(owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner)` Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_CREATE` event occurred. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/lifecycle/DefaultLifecycleObserver#onDestroy(androidx.lifecycle.LifecycleOwner)(owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner)` Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_DESTROY` event occurred. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/lifecycle/DefaultLifecycleObserver#onPause(androidx.lifecycle.LifecycleOwner)(owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner)` Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_PAUSE` event occurred. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/lifecycle/DefaultLifecycleObserver#onResume(androidx.lifecycle.LifecycleOwner)(owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner)` Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_RESUME` event occurred. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/lifecycle/DefaultLifecycleObserver#onStart(androidx.lifecycle.LifecycleOwner)(owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner)` Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_START` event occurred. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/lifecycle/DefaultLifecycleObserver#onStop(androidx.lifecycle.LifecycleOwner)(owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner)` Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_STOP` event occurred. | Cmn |

## Public functions

### onCreate

Cmn Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0)

```
open fun onCreate(owner: LifecycleOwner): Unit
```

Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_CREATE` event occurred.

Called after the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner`'s `onCreate` method returns.

| Parameters |
|---|---|
| `owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` | The component whose state changed. |

### onDestroy

Cmn Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0)

```
open fun onDestroy(owner: LifecycleOwner): Unit
```

Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_DESTROY` event occurred.

Called before the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner`'s `onDestroy` method is called.

| Parameters |
|---|---|
| `owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` | The component whose state changed. |

### onPause

Cmn Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0)

```
open fun onPause(owner: LifecycleOwner): Unit
```

Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_PAUSE` event occurred.

Called before the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner`'s `onPause` method is called.

| Parameters |
|---|---|
| `owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` | The component whose state changed. |

### onResume

Cmn Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0)

```
open fun onResume(owner: LifecycleOwner): Unit
```

Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_RESUME` event occurred.

Called after the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner`'s `onResume` method returns.

| Parameters |
|---|---|
| `owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` | The component whose state changed. |

### onStart

Cmn Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0)

```
open fun onStart(owner: LifecycleOwner): Unit
```

Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_START` event occurred.

Called after the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner`'s `onStart` method returns.

| Parameters |
|---|---|
| `owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` | The component whose state changed. |

### onStop

Cmn Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0)

```
open fun onStop(owner: LifecycleOwner): Unit
```

Notifies that `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.Event#ON_STOP` event occurred.

Called before the `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner`'s `onStop` method is called.

| Parameters |
|---|---|
| `owner: https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` | The component whose state changed. |