Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

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.Builder setInitialDelay(Duration duration)

Add an initial delay to the OneTimeWorkRequest.

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

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

Parameters
workerClass Class

Public methods

setInitialDelay

public OneTimeWorkRequest.Builder setInitialDelay (Duration duration)

Add an initial delay to the OneTimeWorkRequest.

Parameters
duration Duration: The length of the delay

Returns
OneTimeWorkRequest.Builder The current OneTimeWorkRequest.Builder

setInitialDelay

public 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

public 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