CancellableTask
abstract class CancellableTask<StateT> : 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 functions |
|
|---|---|
abstract CancellableTask<StateT!> |
addOnProgressListener(listener: OnProgressListener<Any!>)Adds a listener that is called periodically while the ControllableTask executes. |
abstract CancellableTask<StateT!> |
addOnProgressListener(Adds a listener that is called periodically while the ControllableTask executes. |
abstract 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 functions |
||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
Public functions
addOnProgressListener
abstract fun addOnProgressListener(listener: OnProgressListener<Any!>): CancellableTask<StateT!>
Adds a listener that is called periodically while the ControllableTask executes.
| Returns | |
|---|---|
CancellableTask<StateT!> |
this Task |
addOnProgressListener
abstract fun addOnProgressListener(
activity: Activity,
listener: OnProgressListener<Any!>
): CancellableTask<StateT!>
Adds a listener that is called periodically while the ControllableTask executes.
| Parameters | |
|---|---|
activity: Activity |
When the supplied |
| Returns | |
|---|---|
CancellableTask<StateT!> |
this Task |
addOnProgressListener
abstract fun addOnProgressListener(
executor: Executor,
listener: OnProgressListener<Any!>
): CancellableTask<StateT!>
Adds a listener that is called periodically while the ControllableTask executes.
| Parameters | |
|---|---|
executor: Executor |
the executor to use to call the listener |
| Returns | |
|---|---|
CancellableTask<StateT!> |
this Task |
cancel
abstract fun cancel(): Boolean
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
abstract fun isInProgress(): Boolean
| Returns | |
|---|---|
Boolean |
true if the task is currently running. |