android-components / mozilla.components.browser.session.storage / AutoSave

# AutoSave

`class AutoSave` (source)

### Constructors

<init> | `AutoSave(sessionManager: SessionManager, sessionStorage: SessionStorage, minimumIntervalMs: Long)`

### Functions

periodicallyInForeground | `fun periodicallyInForeground(interval: Long = 300, unit: TimeUnit = TimeUnit.SECONDS, scheduler: ScheduledExecutorService = Executors.newSingleThreadScheduledExecutor(), lifecycle: Lifecycle = ProcessLifecycleOwner.get().lifecycle): AutoSave` Saves the state periodically when the app is in the foreground.
whenGoingToBackground | `fun whenGoingToBackground(lifecycle: Lifecycle = ProcessLifecycleOwner.get().lifecycle): AutoSave` Saves the state automatically when the app goes to the background.
whenSessionsChange | `fun whenSessionsChange(): AutoSave` Saves the state automatically when the sessions change, e.g. sessions get added and removed.