LoadBundleTask

public classLoadBundleTask extendsTask


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

@NonNullTask<LoadBundleTaskProgress>

Adds a listener that is called if theTask is canceled.

@NonNullTask<LoadBundleTaskProgress>
addOnCanceledListener(
    @NonNullActivity activity,
    @NonNullOnCanceledListener onCanceledListener
)

Adds an Activity-scoped listener that is called if theTask is canceled.

@NonNullTask<LoadBundleTaskProgress>
addOnCanceledListener(
    @NonNullExecutor executor,
    @NonNullOnCanceledListener onCanceledListener
)

Adds a listener that is called if theTask is canceled.

@NonNullTask<LoadBundleTaskProgress>

Adds a listener that is called when theTask succeeds or fails.

@NonNullTask<LoadBundleTaskProgress>

Adds a listener that is called when theTask succeeds or fails.

@NonNullTask<LoadBundleTaskProgress>

Adds a listener that is called when theTask succeeds or fails.

@NonNullTask<LoadBundleTaskProgress>

Adds a listener that is called if theTask fails.

@NonNullTask<LoadBundleTaskProgress>
addOnFailureListener(
    @NonNullActivity activity,
    @NonNullOnFailureListener onFailureListener
)

Adds a listener that is called if theTask fails.

@NonNullTask<LoadBundleTaskProgress>
addOnFailureListener(
    @NonNullExecutor executor,
    @NonNullOnFailureListener onFailureListener
)

Adds a listener that is called if theTask fails.

@NonNullLoadBundleTask

Adds a listener that is called periodically while theLoadBundleTask executes.

@NonNullLoadBundleTask

Adds a listener that is called periodically while theLoadBundleTask executes.

@NonNullLoadBundleTask

Adds a listener that is called periodically while theLoadBundleTask executes.

@NonNullTask<LoadBundleTaskProgress>

Adds a listener that is called if theTask completes successfully.

@NonNullTask<LoadBundleTaskProgress>
addOnSuccessListener(
    @NonNullActivity activity,
    @NonNullOnSuccessListener<Object> onSuccessListener
)

Adds a listener that is called if theTask completes successfully.

@NonNullTask<LoadBundleTaskProgress>
addOnSuccessListener(
    @NonNullExecutor executor,
    @NonNullOnSuccessListener<Object> onSuccessListener
)

Adds a listener that is called if theTask completes successfully.

@NonNullTask<TContinuationResult>
<TContinuationResult>continueWith(
    @NonNullContinuation<LoadBundleTaskProgress, TContinuationResult> continuation
)

Returns a newTask that will be completed with the result of applying the specified Continuation to this Task.

@NonNullTask<TContinuationResult>
<TContinuationResult>continueWith(
    @NonNullExecutor executor,
    @NonNullContinuation<LoadBundleTaskProgress, TContinuationResult> continuation
)

Returns a newTask that will be completed with the result of applying the specifiedContinuation to this Task.

@NonNullTask<TContinuationResult>
<TContinuationResult>continueWithTask(
    @NonNullContinuation<LoadBundleTaskProgressTask<TContinuationResult>> continuation
)

Returns a newTask that will be completed with the result of applying the specifiedContinuation to this Task.

@NonNullTask<TContinuationResult>
<TContinuationResult>continueWithTask(
    @NonNullExecutor executor,
    @NonNullContinuation<LoadBundleTaskProgressTask<TContinuationResult>> continuation
)

Returns a newTask that will be completed with the result of applying the specifiedContinuation to this Task.

@NullableException

Returns the exception that caused theTask to fail.

@NonNullLoadBundleTaskProgress

Gets the result of theTask, if it has already completed.

@NonNullLoadBundleTaskProgress
<X extends Throwable>getResult(@NonNullClass<X> exceptionType)

Gets the result of theTask, if it has already completed.

boolean

Returnstrue if the task has been canceled.

boolean

Returnstrue if theTask is complete;false otherwise.

boolean

Returnstrue if theTask has completed successfully;false otherwise.

@NonNullTask<TContinuationResult>
<TContinuationResult>onSuccessTask(
    @NonNullSuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation
)

Returns a newTask that will be completed with the result of applying the specifiedSuccessContinuation to thisTask when thisTask completes successfully.

@NonNullTask<TContinuationResult>
<TContinuationResult>onSuccessTask(
    @NonNullExecutor executor,
    @NonNullSuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation
)

Returns a newTask that will be completed with the result of applying the specifiedSuccessContinuation to thisTask when thisTask completes successfully.

Public methods

addOnCanceledListener

public @NonNullTask<LoadBundleTaskProgressaddOnCanceledListener(@NonNullOnCanceledListener onCanceledListener)

Adds a listener that is called if theTask is canceled.

The listener will be called on main application thread. If theTask 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.

addOnCanceledListener

public @NonNullTask<LoadBundleTaskProgressaddOnCanceledListener(
    @NonNullActivity activity,
    @NonNullOnCanceledListener onCanceledListener
)

Adds an Activity-scoped listener that is called if theTask 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 duringonStop.

addOnCanceledListener

public @NonNullTask<LoadBundleTaskProgressaddOnCanceledListener(
    @NonNullExecutor executor,
    @NonNullOnCanceledListener onCanceledListener
)

Adds a listener that is called if theTask 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.

Parameters
@NonNullExecutor executor

the executor to use to call the listener

addOnCompleteListener

public @NonNullTask<LoadBundleTaskProgressaddOnCompleteListener(
    @NonNullOnCompleteListener<LoadBundleTaskProgress> onCompleteListener
)

Adds a listener that is called when theTask 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.

addOnCompleteListener

public @NonNullTask<LoadBundleTaskProgressaddOnCompleteListener(
    @NonNullActivity activity,
    @NonNullOnCompleteListener<LoadBundleTaskProgress> onCompleteListener
)

Adds a listener that is called when theTask 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
@NonNullActivity activity

When the suppliedActivity stops, this listener will automatically be removed.

addOnCompleteListener

public @NonNullTask<LoadBundleTaskProgressaddOnCompleteListener(
    @NonNullExecutor executor,
    @NonNullOnCompleteListener<LoadBundleTaskProgress> onCompleteListener
)

Adds a listener that is called when theTask 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
@NonNullExecutor executor

the executor to use to call the listener

addOnFailureListener

public @NonNullTask<LoadBundleTaskProgressaddOnFailureListener(@NonNullOnFailureListener onFailureListener)

Adds a listener that is called if theTask 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.

addOnFailureListener

public @NonNullTask<LoadBundleTaskProgressaddOnFailureListener(
    @NonNullActivity activity,
    @NonNullOnFailureListener onFailureListener
)

Adds a listener that is called if theTask 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
@NonNullActivity activity

When the suppliedActivity stops, this listener will automatically be removed.

addOnFailureListener

public @NonNullTask<LoadBundleTaskProgressaddOnFailureListener(
    @NonNullExecutor executor,
    @NonNullOnFailureListener onFailureListener
)

Adds a listener that is called if theTask 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
@NonNullExecutor executor

the executor to use to call the listener

addOnProgressListener

public @NonNullLoadBundleTask addOnProgressListener(
    @NonNullOnProgressListener<LoadBundleTaskProgress> listener
)

Adds a listener that is called periodically while theLoadBundleTask 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 duringonStop.

Returns
@NonNullLoadBundleTask

thisTask

addOnProgressListener

public @NonNullLoadBundleTask addOnProgressListener(
    @NonNullActivity activity,
    @NonNullOnProgressListener<LoadBundleTaskProgress> listener
)

Adds a listener that is called periodically while theLoadBundleTask 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 duringonStop.

Parameters
@NonNullActivity activity

When the suppliedActivity stops, this listener will automatically be removed.

Returns
@NonNullLoadBundleTask

thisTask

addOnProgressListener

public @NonNullLoadBundleTask addOnProgressListener(
    @NonNullExecutor executor,
    @NonNullOnProgressListener<LoadBundleTaskProgress> listener
)

Adds a listener that is called periodically while theLoadBundleTask executes.

If multiple listeners are added, they will be called in the order in which they were added.

Parameters
@NonNullExecutor executor

the executor to use to call the listener

Returns
@NonNullLoadBundleTask

thisTask

addOnSuccessListener

public @NonNullTask<LoadBundleTaskProgressaddOnSuccessListener(
    @NonNullOnSuccessListener<Object> onSuccessListener
)

Adds a listener that is called if theTask 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.

addOnSuccessListener

public @NonNullTask<LoadBundleTaskProgressaddOnSuccessListener(
    @NonNullActivity activity,
    @NonNullOnSuccessListener<Object> onSuccessListener
)

Adds a listener that is called if theTask 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
@NonNullActivity activity

When the suppliedActivity stops, this listener will automatically be removed.

addOnSuccessListener

public @NonNullTask<LoadBundleTaskProgressaddOnSuccessListener(
    @NonNullExecutor executor,
    @NonNullOnSuccessListener<Object> onSuccessListener
)

Adds a listener that is called if theTask 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
@NonNullExecutor executor

the executor to use to call the listener

continueWith

public @NonNullTask<TContinuationResult> <TContinuationResult>continueWith(
    @NonNullContinuation<LoadBundleTaskProgress, TContinuationResult> continuation
)

Returns a newTask that will be completed with the result of applying the specified Continuation to this Task.

TheContinuation will be called on the main application thread.

See also
then

continueWith

public @NonNullTask<TContinuationResult> <TContinuationResult>continueWith(
    @NonNullExecutor executor,
    @NonNullContinuation<LoadBundleTaskProgress, TContinuationResult> continuation
)

Returns a newTask that will be completed with the result of applying the specifiedContinuation to this Task.

Parameters
@NonNullExecutor executor

the executor to use to call the Continuation

See also
then

continueWithTask

public @NonNullTask<TContinuationResult> <TContinuationResult>continueWithTask(
    @NonNullContinuation<LoadBundleTaskProgressTask<TContinuationResult>> continuation
)

Returns a newTask that will be completed with the result of applying the specifiedContinuation to this Task.

The Continuation will be called on the main application thread.

See also
then

continueWithTask

public @NonNullTask<TContinuationResult> <TContinuationResult>continueWithTask(
    @NonNullExecutor executor,
    @NonNullContinuation<LoadBundleTaskProgressTask<TContinuationResult>> continuation
)

Returns a newTask that will be completed with the result of applying the specifiedContinuation to this Task.

Parameters
@NonNullExecutor executor

the executor to use to call theContinuation

See also
then

getException

public @NullableException getException()

Returns the exception that caused theTask to fail. Returnsnull if the Task is not yet complete, or completed successfully.

getResult

public @NonNullLoadBundleTaskProgress getResult()

Gets the result of theTask, 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 @NonNullLoadBundleTaskProgress <X extends Throwable>getResult(@NonNullClass<X> exceptionType)

Gets the result of theTask, 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

isCanceled

public boolean isCanceled()

Returnstrue if the task has been canceled.

isComplete

public boolean isComplete()

Returnstrue if theTask is complete;false otherwise.

isSuccessful

public boolean isSuccessful()

Returnstrue if theTask has completed successfully;false otherwise.

onSuccessTask

public @NonNullTask<TContinuationResult> <TContinuationResult>onSuccessTask(
    @NonNullSuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation
)

Returns a newTask that will be completed with the result of applying the specifiedSuccessContinuation to thisTask when thisTask completes successfully. If the previousTask fails, theonSuccessTask completion will be skipped and failure listeners will be invoked.

TheSuccessContinuation will be called on the main application thread.

If the previousTask is canceled, the returned Task will also be canceled and theSuccessContinuation would not execute.

onSuccessTask

public @NonNullTask<TContinuationResult> <TContinuationResult>onSuccessTask(
    @NonNullExecutor executor,
    @NonNullSuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation
)

Returns a newTask that will be completed with the result of applying the specifiedSuccessContinuation to thisTask when thisTask completes successfully. If the previousTask fails, the onSuccessTask completion will be skipped and failure listeners will be invoked.

If the previousTask is canceled, the returnedTask will also be canceled and theSuccessContinuation would not execute.

Parameters
@NonNullExecutor executor

the executor to use to call the SuccessContinuation

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.