Periodic and Chained Work
Repeat and sequence background tasks.
Periodic and Chained Work
Beyond one-shot tasks, WorkManager can repeat work on a schedule and chain multiple workers so they run in sequence. This lesson covers both.
PeriodicWorkRequest
For recurring work, use PeriodicWorkRequestBuilder, specifying a repeat interval. WorkManager re-runs the worker once per interval.
val periodic = PeriodicWorkRequestBuilder<SyncWorker>(
repeatInterval = 1,
repeatIntervalTimeUnit = TimeUnit.HOURS
).build()All lessons in this course
- When to Use WorkManager
- Creating a Worker
- Constraints and Scheduling
- Periodic and Chained Work