WorkManager
Also known as: android workmanager, deferred background work
WorkManager is the Android Jetpack library for scheduling deferrable, guaranteed background work that must run even if the app exits or the device reboots. It picks JobScheduler or an internal fallback per OS version, and respects Doze and battery limits.
- Minimum repeat interval for PeriodicWorkRequest is 15 minutes.
- Backs work with an internal Room/SQLite database so it survives reboots.
- Delegates to JobScheduler on API 23+ and honors Doze maintenance windows.
What WorkManager does
WorkManager is the recommended Jetpack solution for persistent background work on Android. You enqueue a `OneTimeWorkRequest` or `PeriodicWorkRequest` and the system runs it later, surviving app process death and device reboots.
Under the hood WorkManager dispatches through JobScheduler on Android 6.0 (API 23) and above, having dropped its older Firebase JobDispatcher and AlarmManager+BroadcastReceiver fallbacks once minSdk moved past API 23. Work is recorded in an internal Room database so it is durable across restarts.
You attach Constraints such as requiring charging, an unmetered network, or device idle, and the system defers execution until they are met. Periodic work has a minimum interval of 15 minutes.
How a cleaner uses it
A storage cleaner schedules its background scan as WorkManager work so the index of files, caches, and duplicate hashes stays fresh without the user reopening the app.
Constraints keep scans cheap: a cleaner typically requires device idle and charging so a heavy filesystem walk never drains the battery or competes with foreground apps. Because the OS enforces Doze Mode, periodic scans are batched into maintenance windows rather than running on a strict clock.