Builder
class Builder : WorkRequest.Builder<OneTimeWorkRequest.Builder!, OneTimeWorkRequest!>
Builder for OneTimeWorkRequest
s.
Summary
Inherited functions |
From class Builder
B |
addTag(@NonNull tag: String)
Adds a tag for the work. You can query and cancel work by tags. Tags are particularly useful for modules or libraries to find and operate on their own work.
|
W |
build()
Builds a WorkRequest based on this Builder .
|
B |
keepResultsForAtLeast(duration: Long, @NonNull timeUnit: TimeUnit)
Specifies that the results of this work should be kept for at least the specified amount of time. After this time has elapsed, the results may be pruned at the discretion of WorkManager when there are no pending dependent jobs.
When the results of a work are pruned, it becomes impossible to query for its WorkInfo .
Specifying a long duration here may adversely affect performance in terms of app storage and database query time.
|
B |
keepResultsForAtLeast(@NonNull duration: Duration)
Specifies that the results of this work should be kept for at least the specified amount of time. After this time has elapsed, the results
may
be pruned at the discretion of WorkManager when this WorkRequest has reached a finished state (see WorkInfo.State#isFinished() ) and there are no pending dependent jobs.
When the results of a work are pruned, it becomes impossible to query for its WorkInfo .
Specifying a long duration here may adversely affect performance in terms of app storage and database query time.
|
B |
setBackoffCriteria(@NonNull backoffPolicy: BackoffPolicy, backoffDelay: Long, @NonNull timeUnit: TimeUnit)
Sets the backoff policy and backoff delay for the work. The default values are BackoffPolicy#EXPONENTIAL and {@value WorkRequest#DEFAULT_BACKOFF_DELAY_MILLIS}, respectively. backoffDelay will be clamped between WorkRequest#MIN_BACKOFF_MILLIS and WorkRequest#MAX_BACKOFF_MILLIS .
|
B |
setBackoffCriteria(@NonNull backoffPolicy: BackoffPolicy, @NonNull duration: Duration)
Sets the backoff policy and backoff delay for the work. The default values are BackoffPolicy#EXPONENTIAL and {@value WorkRequest#DEFAULT_BACKOFF_DELAY_MILLIS}, respectively. duration will be clamped between WorkRequest#MIN_BACKOFF_MILLIS and WorkRequest#MAX_BACKOFF_MILLIS .
|
B |
setConstraints(@NonNull constraints: Constraints)
Adds constraints to the WorkRequest .
|
B |
setInitialDelay(duration: Long, @NonNull timeUnit: TimeUnit)
Sets an initial delay for the WorkRequest .
|
B |
setInitialDelay(@NonNull duration: Duration)
Sets an initial delay for the WorkRequest .
|
B |
setInputData(@NonNull inputData: Data)
Adds input Data to the work. If a worker has prerequisites in its chain, this Data will be merged with the outputs of the prerequisites using an InputMerger .
|
|
Public constructors
Public methods