OneTimeWorkRequest.Builder

public static final class OneTimeWorkRequest.Builder
extends Builder<OneTimeWorkRequest.BuilderOneTimeWorkRequest>

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


Builder for OneTimeWorkRequest class.

Summary

Public constructors

OneTimeWorkRequest.Builder(Class<? extends Worker> workerClass)

Public methods

OneTimeWorkRequest build()

Builds this work object.

OneTimeWorkRequest.Builder setInitialDelay(long duration, TimeUnit timeUnit)

Add an initial delay to the OneTimeWorkRequest.

OneTimeWorkRequest.Builder setInputMerger(Class<? extends InputMerger> inputMerger)

Specify the InputMerger class name for this OneTimeWorkRequest.

Inherited methods

Public constructors

OneTimeWorkRequest.Builder

OneTimeWorkRequest.Builder (Class<? extends Worker> workerClass)

Parameters
workerClass Class

Public methods

build

OneTimeWorkRequest build ()

Builds this work object.

Returns
OneTimeWorkRequest The concrete implementation of the work associated with this builder

setInitialDelay

OneTimeWorkRequest.Builder setInitialDelay (long duration, 
                TimeUnit timeUnit)

Add an initial delay to the OneTimeWorkRequest.

Parameters
duration long: The length of the delay in timeUnit units

timeUnit TimeUnit: The units of time for duration

Returns
OneTimeWorkRequest.Builder The current OneTimeWorkRequest.Builder

setInputMerger

OneTimeWorkRequest.Builder setInputMerger (Class<? extends InputMerger> inputMerger)

Specify the InputMerger class name for this OneTimeWorkRequest. An InputMerger takes one or more Data inputs to a Worker and converts them to a single merged Data to be used as its input. The default InputMerger is OverwritingInputMerger.

Parameters
inputMerger Class: The class name of the InputMerger for this OneTimeWorkRequest

Returns
OneTimeWorkRequest.Builder The current OneTimeWorkRequest.Builder