[android-components](../../index.md) / [mozilla.components.browser.session.storage](../index.md) / [AutoSave](index.md) / [whenGoingToBackground](./when-going-to-background.md)

# whenGoingToBackground

`fun whenGoingToBackground(lifecycle: Lifecycle = ProcessLifecycleOwner.get().lifecycle): `[`AutoSave`](index.md) [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/browser/session/src/main/java/mozilla/components/browser/session/storage/AutoSave.kt#L62)

Saves the state automatically when the app goes to the background.

