LoadBundleTask
public class LoadBundleTask extends Task
Represents the task of loading a Firestore bundle. It provides progress of bundle loading, as well as task completion and error events.
Summary
Public methods |
|
---|---|
@NonNull Task<LoadBundleTaskProgress> |
addOnCanceledListener(@NonNull OnCanceledListener onCanceledListener) Adds a listener that is called if the |
@NonNull Task<LoadBundleTaskProgress> |
addOnCanceledListener( Adds an Activity-scoped listener that is called if the |
@NonNull Task<LoadBundleTaskProgress> |
addOnCanceledListener( Adds a listener that is called if the |
@NonNull Task<LoadBundleTaskProgress> |
addOnCompleteListener( Adds a listener that is called when the |
@NonNull Task<LoadBundleTaskProgress> |
addOnCompleteListener( Adds a listener that is called when the |
@NonNull Task<LoadBundleTaskProgress> |
addOnCompleteListener( Adds a listener that is called when the |
@NonNull Task<LoadBundleTaskProgress> |
addOnFailureListener(@NonNull OnFailureListener onFailureListener) Adds a listener that is called if the |
@NonNull Task<LoadBundleTaskProgress> |
addOnFailureListener( Adds a listener that is called if the |
@NonNull Task<LoadBundleTaskProgress> |
addOnFailureListener( Adds a listener that is called if the |
@NonNull LoadBundleTask |
Adds a listener that is called periodically while the |
@NonNull LoadBundleTask |
addOnProgressListener( Adds a listener that is called periodically while the |
@NonNull LoadBundleTask |
addOnProgressListener( Adds a listener that is called periodically while the |
@NonNull Task<LoadBundleTaskProgress> |
addOnSuccessListener( Adds a listener that is called if the |
@NonNull Task<LoadBundleTaskProgress> |
addOnSuccessListener( Adds a listener that is called if the |
@NonNull Task<LoadBundleTaskProgress> |
addOnSuccessListener( Adds a listener that is called if the |
@NonNull Task<TContinuationResult> |
<TContinuationResult> continueWith( Returns a new |
@NonNull Task<TContinuationResult> |
<TContinuationResult> continueWith( Returns a new |
@NonNull Task<TContinuationResult> |
<TContinuationResult> continueWithTask( Returns a new |
@NonNull Task<TContinuationResult> |
<TContinuationResult> continueWithTask( Returns a new |
@Nullable Exception |
Returns the exception that caused the |
@NonNull LoadBundleTaskProgress |
Gets the result of the |
@NonNull LoadBundleTaskProgress |
Gets the result of the |
boolean |
Returns |
boolean |
Returns |
boolean |
Returns |
@NonNull Task<TContinuationResult> |
<TContinuationResult> onSuccessTask( Returns a new |
@NonNull Task<TContinuationResult> |
<TContinuationResult> onSuccessTask( Returns a new |
Public methods
addOnCanceledListener
public @NonNull Task<LoadBundleTaskProgress> addOnCanceledListener(@NonNull OnCanceledListener onCanceledListener)
Adds a listener that is called if the Task
is canceled.
The listener will be called on main application thread. If the Task
has already been canceled, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
addOnCanceledListener
public @NonNull Task<LoadBundleTaskProgress> addOnCanceledListener(
@NonNull Activity activity,
@NonNull OnCanceledListener onCanceledListener
)
Adds an Activity-scoped listener that is called if the Task
is canceled.
The listener will be called on main application thread. If the task has already been canceled, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
The listener will be automatically removed during onStop
.
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this Task |
addOnCanceledListener
public @NonNull Task<LoadBundleTaskProgress> addOnCanceledListener(
@NonNull Executor executor,
@NonNull OnCanceledListener onCanceledListener
)
Adds a listener that is called if the Task
is canceled.
If the task has already been canceled, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this Task |
addOnCompleteListener
public @NonNull Task<LoadBundleTaskProgress> addOnCompleteListener(
@NonNull OnCompleteListener<LoadBundleTaskProgress> onCompleteListener
)
Adds a listener that is called when the Task
succeeds or fails.
The listener will be called on main application thread. If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
addOnCompleteListener
public @NonNull Task<LoadBundleTaskProgress> addOnCompleteListener(
@NonNull Activity activity,
@NonNull OnCompleteListener<LoadBundleTaskProgress> onCompleteListener
)
Adds a listener that is called when the Task
succeeds or fails.
If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Parameters | |
---|---|
@NonNull Activity activity |
When the supplied |
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
addOnCompleteListener
public @NonNull Task<LoadBundleTaskProgress> addOnCompleteListener(
@NonNull Executor executor,
@NonNull OnCompleteListener<LoadBundleTaskProgress> onCompleteListener
)
Adds a listener that is called when the Task
succeeds or fails.
If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
addOnFailureListener
public @NonNull Task<LoadBundleTaskProgress> addOnFailureListener(@NonNull OnFailureListener onFailureListener)
Adds a listener that is called if the Task
fails.
The listener will be called on main application thread. If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
addOnFailureListener
public @NonNull Task<LoadBundleTaskProgress> addOnFailureListener(
@NonNull Activity activity,
@NonNull OnFailureListener onFailureListener
)
Adds a listener that is called if the Task
fails.
If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Parameters | |
---|---|
@NonNull Activity activity |
When the supplied |
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
addOnFailureListener
public @NonNull Task<LoadBundleTaskProgress> addOnFailureListener(
@NonNull Executor executor,
@NonNull OnFailureListener onFailureListener
)
Adds a listener that is called if the Task
fails.
If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
addOnProgressListener
public @NonNull LoadBundleTask addOnProgressListener(
@NonNull OnProgressListener<LoadBundleTaskProgress> listener
)
Adds a listener that is called periodically while the LoadBundleTask
executes.
The listener will be called on main application thread. If multiple listeners are added, they will be called in the order in which they were added.
The listener will be automatically removed during onStop
.
Returns | |
---|---|
@NonNull LoadBundleTask |
this |
addOnProgressListener
public @NonNull LoadBundleTask addOnProgressListener(
@NonNull Activity activity,
@NonNull OnProgressListener<LoadBundleTaskProgress> listener
)
Adds a listener that is called periodically while the LoadBundleTask
executes.
The listener will be called on main application thread. If multiple listeners are added, they will be called in the order in which they were added.
The listener will be automatically removed during onStop
.
Parameters | |
---|---|
@NonNull Activity activity |
When the supplied |
Returns | |
---|---|
@NonNull LoadBundleTask |
this |
addOnProgressListener
public @NonNull LoadBundleTask addOnProgressListener(
@NonNull Executor executor,
@NonNull OnProgressListener<LoadBundleTaskProgress> listener
)
Adds a listener that is called periodically while the LoadBundleTask
executes.
If multiple listeners are added, they will be called in the order in which they were added.
Returns | |
---|---|
@NonNull LoadBundleTask |
this |
addOnSuccessListener
public @NonNull Task<LoadBundleTaskProgress> addOnSuccessListener(
@NonNull OnSuccessListener<Object> onSuccessListener
)
Adds a listener that is called if the Task
completes successfully. The listener will be called on the main application thread. If the task has already completed successfully, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
addOnSuccessListener
public @NonNull Task<LoadBundleTaskProgress> addOnSuccessListener(
@NonNull Activity activity,
@NonNull OnSuccessListener<Object> onSuccessListener
)
Adds a listener that is called if the Task
completes successfully.
If multiple listeners are added, they will be called in the order in which they were added. If the task has already completed successfully, a call to the listener will be immediately scheduled.
Parameters | |
---|---|
@NonNull Activity activity |
When the supplied |
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
addOnSuccessListener
public @NonNull Task<LoadBundleTaskProgress> addOnSuccessListener(
@NonNull Executor executor,
@NonNull OnSuccessListener<Object> onSuccessListener
)
Adds a listener that is called if the Task
completes successfully.
If multiple listeners are added, they will be called in the order in which they were added. If the task has already completed successfully, a call to the listener will be immediately scheduled.
Returns | |
---|---|
@NonNull Task<LoadBundleTaskProgress> |
this |
continueWith
public @NonNull Task<TContinuationResult> <TContinuationResult> continueWith(
@NonNull Continuation<LoadBundleTaskProgress, TContinuationResult> continuation
)
Returns a new Task
that will be completed with the result of applying the specified Continuation to this Task.
The Continuation
will be called on the main application thread.
See also | |
---|---|
then |
continueWith
public @NonNull Task<TContinuationResult> <TContinuationResult> continueWith(
@NonNull Executor executor,
@NonNull Continuation<LoadBundleTaskProgress, TContinuationResult> continuation
)
Returns a new Task
that will be completed with the result of applying the specified Continuation
to this Task.
See also | |
---|---|
then |
continueWithTask
public @NonNull Task<TContinuationResult> <TContinuationResult> continueWithTask(
@NonNull Continuation<LoadBundleTaskProgress, Task<TContinuationResult>> continuation
)
Returns a new Task
that will be completed with the result of applying the specified Continuation
to this Task.
The Continuation will be called on the main application thread.
See also | |
---|---|
then |
continueWithTask
public @NonNull Task<TContinuationResult> <TContinuationResult> continueWithTask(
@NonNull Executor executor,
@NonNull Continuation<LoadBundleTaskProgress, Task<TContinuationResult>> continuation
)
Returns a new Task
that will be completed with the result of applying the specified Continuation
to this Task.
See also | |
---|---|
then |
getException
public @Nullable Exception getException()
Returns the exception that caused the Task
to fail. Returns null
if the Task is not yet complete, or completed successfully.
getResult
public @NonNull LoadBundleTaskProgress getResult()
Gets the result of the Task
, if it has already completed.
Throws | |
---|---|
java.lang.IllegalStateException java.lang.IllegalStateException |
if the Task is not yet complete |
com.google.android.gms.tasks.RuntimeExecutionException com.google.android.gms.tasks.RuntimeExecutionException |
if the Task failed with an exception |
getResult
public @NonNull LoadBundleTaskProgress <X extends Throwable> getResult(@NonNull Class<X> exceptionType)
Gets the result of the Task
, if it has already completed.
Throws | |
---|---|
java.lang.IllegalStateException java.lang.IllegalStateException |
if the Task is not yet complete |
X X |
if the Task failed with an exception of type X |
com.google.android.gms.tasks.RuntimeExecutionException com.google.android.gms.tasks.RuntimeExecutionException |
if the Task failed with an exception that was not of type X |
isSuccessful
public boolean isSuccessful()
Returns true
if the Task
has completed successfully; false
otherwise.
onSuccessTask
public @NonNull Task<TContinuationResult> <TContinuationResult> onSuccessTask(
@NonNull SuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation
)
Returns a new Task
that will be completed with the result of applying the specified SuccessContinuation
to this Task
when this Task
completes successfully. If the previous Task
fails, the onSuccessTask
completion will be skipped and failure listeners will be invoked.
The SuccessContinuation
will be called on the main application thread.
If the previous Task
is canceled, the returned Task will also be canceled and the SuccessContinuation
would not execute.
See also | |
---|---|
SuccessContinuation |
onSuccessTask
public @NonNull Task<TContinuationResult> <TContinuationResult> onSuccessTask(
@NonNull Executor executor,
@NonNull SuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation
)
Returns a new Task
that will be completed with the result of applying the specified SuccessContinuation
to this Task
when this Task
completes successfully. If the previous Task
fails, the onSuccessTask completion will be skipped and failure listeners will be invoked.
If the previous Task
is canceled, the returned Task
will also be canceled and the SuccessContinuation
would not execute.
See also | |
---|---|
SuccessContinuation |