PeriodicWorkRequest.Builder

public static final class PeriodicWorkRequest.Builder
extends Builder<PeriodicWorkRequest.BuilderPeriodicWorkRequest>

java.lang.Object
   ↳ androidx.work.WorkRequest.Builder<androidx.work.PeriodicWorkRequest.Builderandroidx.work.PeriodicWorkRequest>
     ↳ androidx.work.PeriodicWorkRequest.Builder


Builder for PeriodicWorkRequests.

Summary

Public constructors

Builder(Class<? extends ListenableWorker> workerClass, long repeatInterval, TimeUnit repeatIntervalTimeUnit)

Creates a PeriodicWorkRequest to run periodically once every interval period.

Builder(Class<? extends ListenableWorker> workerClass, Duration repeatInterval)

Creates a PeriodicWorkRequest to run periodically once every interval period.

Builder(Class<? extends ListenableWorker> workerClass, long repeatInterval, TimeUnit repeatIntervalTimeUnit, long flexInterval, TimeUnit flexIntervalTimeUnit)

Creates a PeriodicWorkRequest to run periodically once within the flex period of every interval period.

Builder(Class<? extends ListenableWorker> workerClass, Duration repeatInterval, Duration flexInterval)

Creates a PeriodicWorkRequest to run periodically once within the flex period of every interval period.

Inherited methods

Public constructors

Builder

public Builder (Class<? extends ListenableWorker> workerClass, 
                long repeatInterval, 
                TimeUnit repeatIntervalTimeUnit)

Creates a PeriodicWorkRequest to run periodically once every interval period. The PeriodicWorkRequest is guaranteed to run exactly one time during this interval (subject to OS battery optimizations, such as doze mode). The repeat interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS. It may run immediately, at the end of the period, or any time in between so long as the other conditions are satisfied at the time. The run time of the PeriodicWorkRequest can be restricted to a flex period within an interval (see #Builder(Class, long, TimeUnit, long, TimeUnit)).

Parameters
workerClass Class: The ListenableWorker class to run for this work

repeatInterval long: The repeat interval in repeatIntervalTimeUnit units

repeatIntervalTimeUnit TimeUnit: The TimeUnit for repeatInterval

Builder

public Builder (Class<? extends ListenableWorker> workerClass, 
                Duration repeatInterval)

Creates a PeriodicWorkRequest to run periodically once every interval period. The PeriodicWorkRequest is guaranteed to run exactly one time during this interval (subject to OS battery optimizations, such as doze mode). The repeat interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS. It may run immediately, at the end of the period, or any time in between so long as the oth