fun periodicallyInForeground(interval: Long = 300, unit: TimeUnit = TimeUnit.SECONDS, scheduler: ScheduledExecutorService = Executors.newSingleThreadScheduledExecutor(), lifecycle: Lifecycle = ProcessLifecycleOwner.get().lifecycle): AutoSave
(source)
Saves the state periodically when the app is in the foreground.
interval
- The interval in which the state should be saved to disk.
unit
- The time unit of the interval parameter.