ControllableTask

abstract class ControllableTask<StateT> : CancellableTask

Known direct subclasses
StorageTask

A controllable Task that has a synchronized state machine.

Known indirect subclasses
FileDownloadTask

A task that downloads bytes of a GCS blob to a specified File.

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 paused, resumed and canceled. This task also receives progress and other state change notifications.

Parameters
<StateT>

the type of state this operation returns in events.

Summary

Public constructors

Public functions

abstract ControllableTask<StateT!>

Adds a listener that is called when the Task becomes paused.

abstract ControllableTask<StateT!>

Adds a listener that is called when the Task becomes paused.

abstract ControllableTask<StateT!>

Adds a listener that is called when the Task becomes paused.

abstract Boolean
abstract Boolean

Attempts to pause the task.

abstract Boolean

Attempts to resume this task.

Inherited functions

From com.google.firebase.storage.CancellableTask
abstract CancellableTask<StateT!>

Adds a listener that is called periodically while the ControllableTask executes.

abstract CancellableTask<StateT!>
addOnProgressListener(
    activity: Activity,
    listener: OnProgressListener<Any!>
)

Adds a listener that is called periodically while the ControllableTask executes.

abstract CancellableTask<StateT!>
addOnProgressListener(
    executor: Executor,
    listener: OnProgressListener<Any!>
)

Adds a listener that is called periodically while the ControllableTask executes.

abstract Boolean

Attempts to cancel the task.

abstract Boolean
abstract Boolean
From com.google.android.gms.tasks.Task
Task<TResult!>!
Task<TResult!>!
abstract Task<TResult!>!
abstract Task<TResult!>!
Task<TContinuationResult!>!
<TContinuationResult> continueWith(
    p: Continuation<TResult!, TContinuationResult!>!
)
Task<TContinuationResult!>!
<TContinuationResult> continueWithTask(
    p: Continuation<TResult!, Task<TContinuationResult!>!>!
)
abstract Exception!
abstract TResult!
abstract Boolean
abstract Boolean
abstract Boolean
Task<TContinuationResult!>!
<TContinuationResult> onSuccessTask(
    p: SuccessContinuation<TResult!, TContinuationResult!>!
)

Public constructors

ControllableTask

ControllableTask()

Public functions

addOnPausedListener

abstract fun addOnPausedListener(listener: OnPausedListener<Any!>): ControllableTask<StateT!>

Adds a listener that is called when the Task becomes paused.

Returns
ControllableTask<StateT!>

this Task

addOnPausedListener

abstract fun addOnPausedListener(activity: Activity, listener: OnPausedListener<Any!>): ControllableTask<StateT!>

Adds a listener that is called when the Task becomes paused.

Parameters
activity: Activity

When the supplied Activity stops, this listener will automatically be removed.

Returns
ControllableTask<StateT!>

this Task

addOnPausedListener

abstract fun addOnPausedListener(executor: Executor, listener: OnPausedListener<Any!>): ControllableTask<StateT!>

Adds a listener that is called when the Task becomes paused.

Parameters
executor: Executor

the executor to use to call the listener

Returns
ControllableTask<StateT!>

this Task

isPaused

abstract fun isPaused(): Boolean
Returns
Boolean

true if the task has been paused.

pause

abstract fun pause(): Boolean

Attempts to pause the task. A paused task can later be resumed.

Returns
Boolean

true if this task was successfully paused or is in the process of being paused. Returns false if the task is already completed or in a state that cannot be paused.

resume

abstract fun resume(): Boolean

Attempts to resume this task.

Returns
Boolean

true if the task is successfully resumed or is in the process of being resumed. Returns false if the task is already completed or in a state that cannot be resumed.