Operation
public
interface
Operation
| androidx.work.Operation |
An object that provides information about the execution of an asynchronous command being
performed by WorkManager. Operations are generally tied to enqueue or cancel commands;
when you call one of those commands, they occur asynchronously. You can observe or await these
commands by using the returned Operation.
Summary
Nested classes | |
|---|---|
class |
Operation.State
The lifecycle state of an |
Public methods | |
|---|---|
abstract
ListenableFuture<Operation.State.SUCCESS>
|
getResult()
Gets a |
abstract
LiveData<Operation.State>
|
getState()
Gets a |
Public methods
getResult
public abstract ListenableFuture<Operation.State.SUCCESS> getResult ()
Gets a ListenableFuture for the terminal state of the Operation. This will
only resolve with a Operation.State.SUCCESS. The Operation.State.FAILURE state will come through
as a Throwable on the ListenableFuture. Operation.State.IN_PROGRESS will never
be reported as it's not a terminal state.
Call Future.get() to block until the Operation reaches a terminal
state.
| Returns | |
|---|---|
ListenableFuture<Operation.State.SUCCESS> |
A ListenableFuture with information about Operation's
Operation.State.SUCCESS state.
|
getState
public abstract LiveData<Operation.State> getState ()
Gets a LiveData of the Operation Operation.State.
| Returns | |
|---|---|
LiveData<Operation.State> |
A LiveData of the Operation Operation.State; you must use
LiveData.observe(LifecycleOwner, Observer) to receive updates
|
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-02-24 UTC.