Summary: Ctors | Methods | Inherited Methods | [Expand All]
public abstract class

# CancellableTask

extends Task<TState>

java.lang.Object
↳ | com.google.android.gms.tasks.Task<TState>
| ↳ | com.google.firebase.storage.CancellableTask<TState>

Known Direct Subclasses ControllableTask<TState>
ControllableTask<TState> | Represents an asynchronous operation that can be paused, resumed and canceled.

Known Indirect Subclasses FileDownloadTask, StorageTask<TResult extends StorageTask.ProvideError>, StreamDownloadTask, UploadTask
FileDownloadTask | A task that downloads bytes of a GCS blob to a specified File.
StorageTask<TResult extends StorageTask.ProvideError> | 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.

## Class Overview

Represents an asynchronous operation that can be canceled.

## Summary

Public Constructors
| CancellableTask()

Public Methods
abstract CancellableTask<TState> | addOnProgressListener(OnProgressListener<? super TState> listener) Adds a listener that is called periodically while the ControllableTask executes.
abstract CancellableTask<TState> | addOnProgressListener(Executor executor, OnProgressListener<? super TState> listener) Adds a listener that is called periodically while the ControllableTask executes.
abstract CancellableTask<TState> | addOnProgressListener(Activity activity, OnProgressListener<? super TState> listener) Adds a listener that is called periodically while the ControllableTask executes.
abstract boolean | cancel() Attempts to cancel the task.
abstract boolean | isCanceled()
abstract boolean | isInProgress()

[Expand] Inherited Methods
From class com.google.android.gms.tasks.Task
Task<TState> | addOnCompleteListener(OnCompleteListener<TState> listener) Adds a listener that is called when the Task completes.
Task<TState> | addOnCompleteListener(Activity activity, OnCompleteListener<TState> listener) Adds an Activity-scoped listener that is called when the Task completes.
Task<TState> | addOnCompleteListener(Executor executor, OnCompleteListener<TState> listener) Adds a listener that is called when the Task completes.
abstract Task<TState> | addOnFailureListener(Activity activity, OnFailureListener listener) Adds an Activity-scoped listener that is called if the Task fails.
abstract Task<TState> | addOnFailureListener(OnFailureListener listener) Adds a listener that is called if the Task fails.
abstract Task<TState> | addOnFailureListener(Executor executor, OnFailureListener listener) Adds a listener that is called if the Task fails.
abstract Task<TState> | addOnSuccessListener(Executor executor, OnSuccessListener<? super TResult> listener) Adds a listener that is called if the Task completes successfully.
abstract Task<TState> | addOnSuccessListener(OnSuccessListener<? super TResult> listener) Adds a listener that is called if the Task completes successfully.
abstract Task<TState> | addOnSuccessListener(Activity activity, OnSuccessListener<? super TResult> listener) Adds an Activity-scoped listener that is called if the Task completes successfully.
<TContinuationResult> Task<TContinuationResult> | continueWith(Continuation<TState, TContinuationResult> continuation) Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
<TContinuationResult> Task<TContinuationResult> | continueWith(Executor executor, Continuation<TState, TContinuationResult> continuation) Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
<TContinuationResult> Task<TContinuationResult> | continueWithTask(Continuation<TState, Task<TContinuationResult>> continuation) Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
<TContinuationResult> Task<TContinuationResult> | continueWithTask(Executor executor, Continuation<TState, Task<TContinuationResult>> continuation) Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
abstract Exception | getException() Returns the exception that caused the Task to fail.
abstract TState | getResult() Gets the result of the Task, if it has already completed.
abstract <X extends Throwable> TState | getResult(Class<X> exceptionType) Gets the result of the Task, if it has already completed.
abstract boolean | isComplete() Returns `true` if the Task is complete; `false` otherwise.
abstract boolean | isSuccessful() Returns `true` if the Task has completed successfully; `false` otherwise.
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Public Constructors

#### public CancellableTask ()

## Public Methods

#### public abstract CancellableTask<TState> addOnProgressListener (OnProgressListener<? super TState> listener)

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

##### Returns

- this Task

#### public abstract CancellableTask<TState> addOnProgressListener (Executor executor, OnProgressListener<? super TState> listener)

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

##### Parameters

executor | the executor to use to call the listener

##### Returns

- this Task

#### public abstract CancellableTask<TState> addOnProgressListener (Activity activity, OnProgressListener<? super TState> listener)

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

##### Parameters

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

##### Returns

- this Task

#### 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(OnFailureListener)` with an exception that indicates the task was canceled.

##### Returns

- 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.

#### public abstract boolean isCanceled ()

##### Returns

- true if the task has been canceled.

#### public abstract boolean isInProgress ()

##### Returns

- true if the task is currently running.