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 class.

Summary

Public constructors
<init>(workerClass: Class<out Worker!>, repeatInterval: Long, repeatIntervalTimeUnit: TimeUnit)

Creates a PeriodicWorkRequest to run periodically once every interval period.

<init>(workerClass: Class<out Worker!>, repeatInterval: Duration)

Creates a PeriodicWorkRequest to run periodically once every interval period.

<init>(workerClass: Class<out Worker!>, repeatInterval: Long, repeatIntervalTimeUnit: TimeUnit, flexInterval: Long, flexIntervalTimeUnit: TimeUnit)

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

<init>(workerClass: Class<out Worker!>, repeatInterval: Duration, flexInterval: Duration)

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

Public methods
PeriodicWorkRequest!

Inherited functions

Public constructors

<init>

Builder(workerClass: Class<out Worker!>, repeatInterval: Long, repeatIntervalTimeUnit: TimeUnit)

Creates a PeriodicWorkRequest to run periodically once every interval period. The PeriodicWorkRequest is guaranteed to run exactly one time during this interval. The intervalMillis 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.

Parameters
workerClass Class<out Worker!>: The Worker class to run with this job
repeatInterval Class<out Worker!>: The repeat interval in repeatIntervalTimeUnit units
repeatIntervalTimeUnit Class<out Worker!>: The TimeUnit for repeatInterval

<init>

Builder(workerClass: Class<out Worker!>, repeatInterval: Duration)

Creates a PeriodicWorkRequest to run periodically once every interval period. The PeriodicWorkRequest is guaranteed to run exactly one time during this interval. The intervalMillis 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.

Parameters
workerClass Class<out Worker!>: The Worker class to run with this job
repeatInterval Class<out Worker!>: The repeat interval

<init>

Builder(workerClass: Class<out Worker!>, repeatInterval: Long, repeatIntervalTimeUnit: TimeUnit, flexInterval: Long, 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 intervalMillis - flexMillis to the end of the interval. intervalMillis must be greater than or equal to PeriodicWorkRequest#MIN_PERIODIC_INTERVAL_MILLIS and flexMillis 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 Worker!>: The Worker class to run with this job
repeatInterval Class<out Worker!>: The repeat interval in repeatIntervalTimeUnit units
repeatIntervalTimeUnit Class<out Worker!>: The TimeUnit for repeatInterval
flexInterval Class<out Worker!>: The duration in flexIntervalTimeUnit units for which this work repeats from the end of the repeatInterval
flexIntervalTimeUnit Class<out Worker!>: The TimeUnit for flexInterval

<init>

Builder(workerClass: Class<out Worker!>, repeatInterval: Duration, 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 intervalMillis - flexMillis to the end of the interval. intervalMillis must be greater than or equal to PeriodicWorkRequest#MIN_PERIODIC_INTERVAL_MILLIS and flexMillis 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 Worker!>: The Worker class to run with this job
repeatInterval Class<out Worker!>: The repeat interval
flexInterval Class<out Worker!>: The duration in for which this work repeats from the end of the repeatInterval

Public methods

build

fun build(): PeriodicWorkRequest!