CancellableTask
public abstract class CancellableTask<StateT> extends Task
ControllableTask |
Represents an asynchronous operation that can be paused, resumed and canceled. |
FileDownloadTask |
A task that downloads bytes of a GCS blob to a specified File. |
StorageTask |
A controllable Task that has a synchronized state machine. |
StreamDownloadTask |
A task that downloads bytes of a GCS blob. |
UploadTask |
An controllable task that uploads and fires events for success, progress and failure. |
Represents an asynchronous operation that can be canceled.
| Parameters | |
|---|---|
<StateT> |
the type of state this operation returns in events. |
Summary
Public constructors |
|---|
Public methods |
|
|---|---|
abstract @NonNull CancellableTask<StateT> |
addOnProgressListener(@NonNull OnProgressListener<Object> listener)Adds a listener that is called periodically while the ControllableTask executes. |
abstract @NonNull CancellableTask<StateT> |
addOnProgressListener(Adds a listener that is called periodically while the ControllableTask executes. |
abstract @NonNull CancellableTask<StateT> |
addOnProgressListener(Adds a listener that is called periodically while the ControllableTask executes. |
abstract boolean |
cancel()Attempts to cancel the task. |
abstract boolean |
|
abstract boolean |
Inherited methods |
||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
Public methods
addOnProgressListener
public abstract @NonNull CancellableTask<StateT> addOnProgressListener(@NonNull OnProgressListener<Object> listener)
Adds a listener that is called periodically while the ControllableTask executes.
| Returns | |
|---|---|
@NonNull CancellableTask<StateT> |
this Task |
addOnProgressListener
public abstract @NonNull CancellableTask<StateT> addOnProgressListener(
@NonNull Activity activity,
@NonNull OnProgressListener<Object> listener
)
Adds a listener that is called periodically while the ControllableTask executes.
| Parameters | |
|---|---|
@NonNull Activity activity |
When the supplied |
| Returns | |
|---|---|
@NonNull CancellableTask<StateT> |
this Task |
addOnProgressListener
public abstract @NonNull CancellableTask<StateT> addOnProgressListener(
@NonNull Executor executor,
@NonNull OnProgressListener<Object> listener
)
Adds a listener that is called periodically while the ControllableTask executes.
| Returns | |
|---|---|
@NonNull CancellableTask<StateT> |
this Task |
cancel
public abstract boolean cancel()
Attempts to cancel the task. A canceled task cannot be resumed later. A canceled task calls back on listeners subscribed to addOnFailureListener with an exception that indicates the task was canceled.
| Returns | |
|---|---|
boolean |
true if this task was successfully canceled or is in the process of being canceled. Returns false if the task is already completed or in a state that cannot be canceled. |
isInProgress
public abstract boolean isInProgress()
| Returns | |
|---|---|
boolean |
true if the task is currently running. |