WorkContinuation

public abstract class WorkContinuation
extends Object

java.lang.Object
   ↳ androidx.work.WorkContinuation


An opaque class that allows you to chain together OneTimeWorkRequest.

Summary

Public constructors

WorkContinuation()

Public methods

static WorkContinuation combine(WorkContinuation... continuations)

Combines multiple WorkContinuations to allow for complex chaining.

static WorkContinuation combine(OneTimeWorkRequest work, WorkContinuation... continuations)

Combines multiple WorkContinuations to allow for complex chaining using the OneTimeWorkRequest provided.

static WorkContinuation combine(List<WorkContinuation> continuations)

Combines multiple WorkContinuations to allow for complex chaining.

static WorkContinuation combine(OneTimeWorkRequest work, List<WorkContinuation> continuations)

Combines multiple WorkContinuations to allow for complex chaining using the OneTimeWorkRequest provided.

abstract void enqueue()

Enqueues the instance of WorkContinuation on the background thread.

abstract LiveData<List<WorkStatus>> getStatuses()

Returns a LiveData list of WorkStatus that provides information about work, their progress, and any resulting output.

abstract SynchronousWorkContinuation synchronous()

Gets an object that gives access to synchronous methods.

final WorkContinuation then(OneTimeWorkRequest... work)

Adds new OneTimeWorkRequest items that depend on the successful completion of all previously added OneTimeWorkRequest.

abstract WorkContinuation then(List<OneTimeWorkRequest> work)

Adds new OneTimeWorkRequest items that depend on the successful completion of all previously added OneTimeWorkRequest.

Inherited methods

Public constructors

WorkContinuation

WorkContinuation ()

Public methods

combine

WorkContinuation combine (WorkContinuation... continuations)

Combines multiple WorkContinuations to allow for complex chaining.

Parameters
continuations WorkContinuation: Two or more WorkContinuations that are prerequisites for the return value

Returns
WorkContinuation A WorkContinuation that allows further chaining

combine

WorkContinuation combine (OneTimeWorkRequest work, 
                WorkContinuation... continuations)

Combines multiple WorkContinuations to allow for complex chaining using the OneTimeWorkRequest provided.

Parameters
work OneTimeWorkRequest: The OneTimeWorkRequest which depends on the successful completion of the provided WorkContinuations

continuations WorkContinuation: Two or more WorkContinuations that are prerequisites for the OneTimeWorkRequest provided.

Returns
WorkContinuation A WorkContinuation that allows further chaining

combine

WorkContinuation combine (List<WorkContinuation> continuations)

Combines multiple WorkContinuations to allow for complex chaining.

Parameters
continuations List: Two or more WorkContinuations that are prerequisites for the return value

Returns
WorkContinuation A WorkContinuation that allows further chaining

combine

WorkContinuation combine (OneTimeWorkRequest work, 
                List<WorkContinuation> continuations)

Combines multiple WorkContinuations to allow for complex chaining using the OneTimeWorkRequest provided.

Parameters
work OneTimeWorkRequest: The OneTimeWorkRequest which depends on the successful completion of the provided WorkContinuations

continuations List: Two or more WorkContinuations that are prerequisites for the OneTimeWorkRequest provided.

Returns
WorkContinuation A WorkContinuation that allows further chaining

enqueue

void enqueue ()

Enqueues the instance of WorkContinuation on the background thread.

getStatuses

LiveData<List<WorkStatus>> getStatuses ()

Returns a LiveData list of WorkStatus that provides information about work, their progress, and any resulting output. If state or outputs of any of the jobs in this chain changes, any attached Observers will trigger.

Returns
LiveData<List<WorkStatus>> A LiveData containing a list of WorkStatuses

synchronous

SynchronousWorkContinuation synchronous ()

Gets an object that gives access to synchronous methods.

Returns
SynchronousWorkContinuation A SynchronousWorkContinuation object, which gives access to synchronous methods

then

WorkContinuation then (OneTimeWorkRequest... work)

Adds new OneTimeWorkRequest items that depend on the successful completion of all previously added OneTimeWorkRequest.

Parameters
work OneTimeWorkRequest: One or more OneTimeWorkRequest to add to the WorkContinuation

Returns
WorkContinuation A WorkContinuation that allows for further chaining of dependent OneTimeWorkRequest

then

WorkContinuation then (List<OneTimeWorkRequest> work)

Adds new OneTimeWorkRequest items that depend on the successful completion of all previously added OneTimeWorkRequest.

Parameters
work List: One or more OneTimeWorkRequest to add to the WorkContinuation

Returns
WorkContinuation A WorkContinuation that allows for further chaining of dependent OneTimeWorkRequest