WorkManager & Background Tasks
Schedule guaranteed background work with WorkManager. Use OneTimeWorkRequest, PeriodicWorkRequest, constraints, data passing, and work chaining.
Background Work in Android
Android aggressively restricts background work to save battery. Before WorkManager, developers used:
- AsyncTask (deprecated)
- AlarmManager (not reliable across reboots/Doze)
- JobScheduler (complex API)
- Services (can be killed, no retry)
WorkManager is the recommended solution for deferrable, guaranteed background work.
What Is WorkManager?
WorkManager guarantees your work runs even if the app is killed or the device reboots. It:
- Persists work across reboots
- Automatically retries on failure
- Supports constraints (WiFi only, charging only, etc.)
- Works on API 14+
- Integrates with Kotlin Coroutines via
CoroutineWorker
All lessons in this course
- Retrofit & REST APIs
- Loading Images with Coil
- Error Handling & UX
- Push Notifications
- WorkManager & Background Tasks
- Publishing to Play Store