Periodic Work

So far, all of the work has been for single tasks, using OneTimeWorkRequest. The other WorkRequest implementation is PeriodicWorkRequest, and as the name suggests, it is for work that should repeat with a given interval.

The interval is provided via the PeriodicWorkRequest.Builder constructor, either as a Duration or as a long and TimeUnit pair. There is a minimum allowed period, defined as PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS, presently defined as 15 minutes.

However, bear in mind that WorkManager is implemented using JobScheduler on newer Android devices. On those devices, Doze mode and app standby will affect your periodic or delayed work. Hence, consider the supplied interval to be a suggestion, more than a requirement.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.