Builder
class Builder : WorkRequest.Builder<PeriodicWorkRequest.Builder!, PeriodicWorkRequest!>
kotlin.Any | ||
↳ | androidx.work.WorkRequest.Builder<androidx.work.PeriodicWorkRequest.Builder, androidx.work.PeriodicWorkRequest> | |
↳ | androidx.work.PeriodicWorkRequest.Builder |
Builder for PeriodicWorkRequest
s.
Summary
Public constructors | |
---|---|
<init>(@NonNull workerClass: Class<out ListenableWorker!>, repeatInterval: Long, @NonNull repeatIntervalTimeUnit: TimeUnit) Creates a |
|
<init>(@NonNull workerClass: Class<out ListenableWorker!>, @NonNull repeatInterval: Duration) Creates a |
|
<init>(@NonNull workerClass: Class<out ListenableWorker!>, repeatInterval: Long, @NonNull repeatIntervalTimeUnit: TimeUnit, flexInterval: Long, @NonNull flexIntervalTimeUnit: TimeUnit) Creates a |
|
<init>(@NonNull workerClass: Class<out ListenableWorker!>, @NonNull repeatInterval: Duration, @NonNull flexInterval: Duration) Creates a |
Inherited functions | |
---|---|
Public constructors
<init>
Builder(
@NonNull workerClass: Class<out ListenableWorker!>,
repeatInterval: Long,
@NonNull repeatIntervalTimeUnit: TimeUnit)
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<out ListenableWorker!>: The ListenableWorker class to run for this work |
repeatInterval |
Long: The repeat interval in repeatIntervalTimeUnit units |
repeatIntervalTimeUnit |
TimeUnit: The TimeUnit for repeatInterval |
<init>
Builder(
@NonNull workerClass: Class<out ListenableWorker!>,
@NonNull repeatInterval: Duration)
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, Duration, Duration)
).
Parameters | |
---|---|
workerClass |
Class<out ListenableWorker!>: The ListenableWorker class to run for this work |
repeatInterval |
Duration: The repeat interval |
<init>
Builder(
@NonNull workerClass: Class<out ListenableWorker!>,
repeatInterval: Long,
@NonNull repeatIntervalTimeUnit: TimeUnit,
flexInterval: Long,
@NonNull flexIntervalTimeUnit: TimeUnit)
Creates a PeriodicWorkRequest
to run periodically once within the flex period of every interval period. See diagram below. The flex period begins at repeatInterval - flexInterval
to the end of the interval. The repeat interval must be greater than or equal to PeriodicWorkRequest#MIN_PERIODIC_INTERVAL_MILLIS
and the flex interval must be greater than or equal to PeriodicWorkRequest#MIN_PERIODIC_FLEX_MILLIS
.
[ before flex | flex ][ before flex | flex ]... [ cannot run work | can run work ][ cannot run work | can run work ]... \____________________________________/\____________________________________/... interval 1 interval 2 ...(repeat)
Parameters | |
---|---|
workerClass |
Class<out ListenableWorker!>: The ListenableWorker class to run for this work |
repeatInterval |
Long: The repeat interval in repeatIntervalTimeUnit units |
repeatIntervalTimeUnit |
TimeUnit: The TimeUnit for repeatInterval |
flexInterval |
Long: The duration in flexIntervalTimeUnit units for which this work repeats from the end of the repeatInterval |
flexIntervalTimeUnit |
TimeUnit: The TimeUnit for flexInterval |
<init>
Builder(
@NonNull workerClass: Class<out ListenableWorker!>,
@NonNull repeatInterval: Duration,
@NonNull flexInterval: Duration)
Creates a PeriodicWorkRequest
to run periodically once within the flex period of every interval period. See diagram below. The flex period begins at repeatInterval - flexInterval
to the end of the interval. The repeat interval must be greater than or equal to PeriodicWorkRequest#MIN_PERIODIC_INTERVAL_MILLIS
and the flex interval must be greater than or equal to PeriodicWorkRequest#MIN_PERIODIC_FLEX_MILLIS
.
[ before flex | flex ][ before flex | flex ]... [ cannot run work | can run work ][ cannot run work | can run work ]... \____________________________________/\____________________________________/... interval 1 interval 2 ...(repeat)
Parameters | |
---|---|
workerClass |