| Return type | Method name |
| boolean | isComplete() Checks whether the task is completed. Returns true if the task is completed; false otherwise. |
| boolean | isSuccessful() Checks whether the task is completed successfully. Returns true if the task is completed successfully; false otherwise. |
| boolean | isCanceled() Checks whether the task is canceled. Returns true if the task is canceled; false otherwise. |
| TResult | getResult() Gets the result of the task if it is completed. |
| < E extends Throwable > TResult | getResult(Class exceptionClass) throws E Gets the result of the task if it is completed. If an exception occurs and belongs to the exception class specified in the parameters, the specified exception class will be returned. |
| Exception | getException() Returns the exception that causes the task to fail. |
| Task< TResult > | addOnSuccessListener(OnSuccessListener< TResult > listener) Adds one or more listeners. If only one listener is added, it will be called following successful completion of the task. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called on the main thread. |
| Task< TResult > | addOnSuccessListener(Executor executor,OnSuccessListener< TResult > listener) Adds one or more listeners. If only one listener is added, it will be called following successful completion of the task. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called in the specified executor. |
| Task< TResult > | addOnFailureListener(OnFailureListener listener) Adds one or more listeners that will be called on the main thread following the task failure. If multiple listeners are added, they will be called in the order in which they were added. |
| Task< TResult > | addOnFailureListener(Executor executor,OnFailureListener listener) Adds one or more listeners that will be called following the task failure. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called in the specified executor. |
| Task< TResult > | addOnCompleteListener(OnCompleteListener < TResult > listener) Adds one or more listeners. If only one listener is added, it will be called on the main thread following task completion. If multiple listeners are added, they will be called in the order in which they were added. |
| Task< TResult > | addOnCompleteListener(Executor executor, OnCompleteListener< TResult > listener) Adds one or more listeners. If only one listener is added, it will be called following task completion. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called in the specified executor. |
| Task< TResult > | addOnCanceledListener(OnCanceledListener listener) Adds one or more listeners. If only one listener is added, it will be called on the main thread following task cancellation. If multiple listeners are added, they will be called in the order in which they were added. |
| Task< TResult > | addOnCanceledListener(Executor executor, OnCanceledListener listener) Adds one or more listeners. If only one listener is added, it will be called following task cancellation. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called in the specified executor. |
| < TContinuationResult > Task< TContinuationResult > | onSuccessTask(SuccessContinuation< TResult, TContinuationResult > listener) After Task< TResult>is successfully executed, execute the then method to call the listener. The method returns a Task< TContinuationResult>value. Creates a new Task< TContinuationResult>task based on the returned Task< TContinuationResult >value. The listener is executed on the main thread. If the current task is canceled, the new task is also canceled and the listener is not executed. If the current task fails, corresponding processing will be performed and the listener will not be executed. |
| < TContinuationResult > Task< TContinuationResult > | onSuccessTask(Executor executor,SuccessContinuation< TResult, TContinuationResult > listener) After Task< TResult>is successfully executed, execute the then method to call the listener. The method returns a Task< TContinuationResult>value. Creates a new Task< TContinuationResult>task based on the returned Task< TContinuationResult >value. The listener is executed on the main thread. If the current task is canceled, the new task is also canceled and the listener is not executed. If the current task fails, corresponding processing will be performed and the listener will not be executed. |
| < TContinuationResult > Task< TContinuationResult > | continueWithTask(Continuation< TResult, Task< TContinuationResult >> taskContinuation) After Task< TResult>is successfully executed, execute the then method to call the listerner. The method returns a Task< TContinuationResult> value. Creates a new Task< TContinuationResult>task based on the returned Task< TContinuationResult >value. The listener is executed in the specified executor. If the current task is canceled, the new task is also canceled and the listener is not executed. If the current task fails, corresponding processing will be performed and the listener will not be executed. |
| < TContinuationResult > Task< TContinuationResult > | continueWithTask(Executor executor,Continuation< TResult, Task< TContinuationResult >> taskContinuation) After Task< TResult>is successfully executed, execute the then method to call the listerner. The method returns a Task< TContinuationResult> value. Creates a new Task< TContinuationResult>task based on the returned Task< TContinuationResult >value. The listener is executed on the main thread. If the current task is canceled, the returned taskContinuation will still be executed. |
| < TContinuationResult > Task< TContinuationResult > | continueWith(Continuation< TResult, TContinuationResult > continuation) After Task< TResult>is successfully executed, execute the then method to call the listerner. The method returns a Task< TContinuationResult>value. Creates a new Task< TContinuationResult>task based on the returned Task< TContinuationResult >value. The listener is executed on the main thread. If the current task is canceled, the returned taskContinuation will not be executed. |
| < TContinuationResult > Task< TContinuationResult > | continueWith(final Executor executor, final Continuation< TResult, TContinuationResult > continuation) After Task< TResult>is successfully executed, execute the then method to call the listerner. The method returns a Task< TContinuationResult>value. Creates a new Task< TContinuationResult>task based on the returned Task< TContinuationResult >value. The listener is executed in the executor. If the current task is canceled, the returned taskContinuation will not be executed. |
| Method |
public abstract boolean isComplete() |
| Checks whether the task is completed. Returns true if the task is completed; false otherwise. |
Return
| type | desc |
| boolean | Returns true if the task is completed; false otherwise. |
| Method |
public abstract boolean isSuccessful() |
| Checks whether the task is completed successfully. Returns true if the task is completed successfully; false otherwise. |
Return
| type | desc |
| boolean | Returns true if the task is completed successfully; false otherwise. |
| Method |
public abstract boolean isCanceled() |
| Checks whether the task is canceled. Returns true if the task is canceled; false otherwise. |
Return
| type | desc |
| boolean | Returns true if the task is canceled; false otherwise. |
| Method |
public abstract TResult getResult() |
| Gets the result of the task if it is completed. |
Return
| type | desc |
| TResult | Result of the task. |
| Method |
public abstract < E extends Throwable > TResult getResult(Class< E > exceptionClass) throws E |
| Gets the result of the task if it is completed. If an exception occurs and belongs to the exception class specified in the parameters, the specified exception class will be returned. |
Parameters
| Parameter name | Parameter desc |
| exceptionClass | Specified exception class. |
| Parameter name | Parameter desc |
| Class< E > | Throws the specified exception class. |
| RuntimeException | RuntimeException returned if the task fails with an exception that does not fall into the class in the input parameter. |
| type | desc |
| TResult | Result of the task. |
| Method |
public abstract Exception getException() |
| Returns the exception that causes the task to fail. |
Return
| type | desc |
| Exception | Exception that causes the task to fail. |
| Method |
public abstract Task< TResult > addOnSuccessListener(OnSuccessListener< TResult > listener) |
| Adds one or more listeners. If only one listener is added, it will be called following successful completion of the task. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called on the main thread. |
Parameters
| Parameter name | Parameter desc |
| listener | Listener, which is called back after a task is successfully completed. |
| type | desc |
| Task | Result of the task. |
| Method |
public abstract Task< TResult > addOnSuccessListener(Executor executor,OnSuccessListener< TResult > listener) |
| Adds one or more listeners. If only one listener is added, it will be called following successful completion of the task. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called in the specified executor. |
Parameters
| Parameter name | Parameter desc |
| executor | Executor to use to call back the listener. |
| listener | Listener, which is called back after a task is successfully completed. |
| type | desc |
| Task< TResult > | Result of the task. |
| Method |
public abstract Task< TResult > addOnFailureListener(OnFailureListener listener) |
| Adds one or more listeners that will be called on the main thread following the task failure. If multiple listeners are added, they will be called in the order in which they were added. |
Parameters
| Parameter name | Parameter desc |
| listener | Listener, which is called back after a task fails. |
| type | desc |
| Task< TResult > | Result of the task. |
| Method |
public abstract Task< TResult > addOnFailureListener(Executor executor,OnFailureListener listener) |
| Adds one or more listeners that will be called following the task failure. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called in the specified executor. |
Parameters
| Parameter name | Parameter desc |
| executor | Executor to use to call back the listener. |
| listener | Listener, which is called back after a task fails. |
| type | desc |
| Task< TResult > | Result of the task. |
| Method |
public Task< TResult > addOnCompleteListener(OnCompleteListener < TResult > listener) |
| Adds one or more listeners. If only one listener is added, it will be called on the main thread following task completion. If multiple listeners are added, they will be called in the order in which they were added. |
Parameters
| Parameter name | Parameter desc |
| listener | Listener, which is called back after task completion. |
| type | desc |
| Task< TResult > | Result of the task. |
| Method |
public Task< TResult > addOnCompleteListener(Executor executor, OnCompleteListener< TResult > listener) |
| Adds one or more listeners. If only one listener is added, it will be called following task completion. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called in the specified executor. |
Parameters
| Parameter name | Parameter desc |
| executor | Executor to use to call back the listener. |
| listener | Listener, which is called back after task completion. |
| type | desc |
| Task< TResult > | Result of the task. |
| Method |
public Task< TResult > addOnCanceledListener(OnCanceledListener listener) |
| Adds one or more listeners. If only one listener is added, it will be called on the main thread following task cancellation. If multiple listeners are added, they will be called in the order in which they were added. |
Parameters
| Parameter name | Parameter desc |
| listener | Listener, which is called back after a task is canceled. |
| type | desc |
| Task< TResult > | Result of the task. |
| Method |
public Task< TResult > addOnCanceledListener(Executor executor, OnCanceledListener listener) |
| Adds one or more listeners. If only one listener is added, it will be called following task cancellation. If multiple listeners are added, they will be called in the order in which they were added. The listener(s) will be called in the specified executor. |
Parameters
| Parameter name | Parameter desc |
| executor | Executor to use to call back the listener. |
| listener | Listener, which is called back after a task is canceled. |
| type | desc |
| Task< TResult > | Result of the task. |
| Method |
public < TContinuationResult > Task< TContinuationResult > onSuccessTask(SuccessContinuation< TResult, TContinuationResult > listener) |
| After Task< TResult >is successfully executed, execute the then method to call the listener. The method returns a Task< TContinuationResult >value. Creates a new Task< TContinuationResult >task based on the returned Task< TContinuationResult >value. The listener is executed on the main thread. If the current task is canceled, the new task is also canceled and the listener is not executed. If the current task fails, corresponding processing will be performed and the listener will not be executed. |
Parameters
| Parameter name | Parameter desc |
| listener | API implementation instance, which implements the then API and is used to call the subsequent task after the current task is successfully completed. |
| type | desc |
| Task< TContinuationResult > | Task subsequent to the current task. |
| Method |
public < TContinuationResult > Task< TContinuationResult > onSuccessTask(Executor executor,SuccessContinuation< TResult, TContinuationResult > listener) |
| After Task< TResult >is successfully executed, execute the then method to call the listerner. The method returns a Task< TContinuationResult > value. Creates a new Task< TContinuationResult >task based on the returned Task< TContinuationResult >value. The listener is executed in the specified executor. If the current task is canceled, the new task is also canceled and the listener is not executed. If the current task fails, corresponding processing will be performed and the listener will not be executed. |
Parameters
| Parameter name | Parameter desc |
| executor | Executor to use to execute the listener. |
| listener | API implementation instance, which implements the then API and is used to call the subsequent task after the current task is successfully completed. |
| type | desc |
| Task< TContinuationResult > | Task subsequent to the current task. |
| Method |
public < TContinuationResult > Task< TContinuationResult > continueWithTask(Continuation< TResult, Task< TContinuationResult >> taskContinuation) |
| After Task< TResult >is successfully executed, execute the then method to call the listerner. The method returns a Task< TContinuationResult > value. Creates a new Task< TContinuationResult >task based on the returned Task< TContinuationResult >value. The listener is executed on the main thread. If the current task is canceled, the returned taskContinuation will still be executed. |
Parameters
| Parameter name | Parameter desc |
| executor | Executor to use to execute taskContinuation. |
| taskContinuation | API implementation instance, which implements the then API and is used to call the subsequent task after the current task is successfully completed. |
| type | desc |
| Task< TContinuationResult > | Task subsequent to the current task. |
| Method |
public < TContinuationResult > Task< TContinuationResult > continueWithTask(Executor executor,Continuation< TResult, Task< TContinuationResult >> taskContinuation) |
| After Task< TResult >is successfully executed, execute the then method to call the listerner. The method returns a Task< TContinuationResult >value. Creates a new Task< TContinuationResult >task based on the returned Task< TContinuationResult >value. The listener is executed in the executor. If the current task is canceled, the returned taskContinuation will still be executed. |
Parameters
| Parameter name | Parameter desc |
| executor | Executor to use to execute taskContinuation. |
| taskContinuation | API implementation instance, which implements the then API and is used to call the subsequent task after the current task is successfully completed. |
| type | desc |
| Task< TContinuationResult > | Task subsequent to the current task. |
| Method |
public < TContinuationResult > Task< TContinuationResult > continueWith(final Executor executor, final Continuation< TResult, TContinuationResult > continuation) |
| After Task< TResult >is successfully executed, execute the then method to call the listerner. The method returns a Task< TContinuationResult >value. Creates a new Task< TContinuationResult >task based on the returned Task< TContinuationResult >value. The listener is executed on the main thread. If the current task is canceled, the returned taskContinuation will not be executed. |
Parameters
| Parameter name | Parameter desc |
| executor | Executor to use to execute the specified continuation. |
| taskContinuation | API implementation instance, which implements the then API and is used to call the subsequent task after the current task is successfully completed. |
| type | desc |
| Task< TContinuationResult > | Task subsequent to the current task. |
| Method |
public void destroy() |
| Destroy the PublisherAdView. This method should be called in the parent Activity’s onDestroy() method. No other methods should be called on the PublisherAdView after destroy() is called. |