Added in API level 31

BatchResultCallback


public interface BatchResultCallback

android.app.appsearch.BatchResultCallback<KeyType, ValueType>


The callback interface to return AppSearchBatchResult.

Summary

Public methods

abstract void onResult(AppSearchBatchResult<KeyType, ValueType> result)

Called when AppSearchBatchResult results are ready.

default void onSystemError(Throwable throwable)

Called when a system error occurs.

Public methods

onResult

Added in API level 31
public abstract void onResult (AppSearchBatchResult<KeyType, ValueType> result)

Called when AppSearchBatchResult results are ready.

Parameters
result AppSearchBatchResult: The result of the executed request. This value cannot be null.

onSystemError

Added in API level 31
public void onSystemError (Throwable throwable)

Called when a system error occurs.

This method is only called the infrastructure is fundamentally broken or unavailable, such that none of the requests could be started. For example, it will be called if the AppSearch service unexpectedly fails to initialize and can't be recovered by any means, or if communicating to the server over Binder fails (e.g. system service crashed or device is rebooting).

The error is not expected to be recoverable and there is no specific recommended action other than displaying a permanent message to the user.

Normal errors that are caused by invalid inputs or recoverable/retriable situations are reported associated with the input that caused them via the onResult(AppSearchBatchResult) method.

Parameters
throwable Throwable: an exception describing the system error This value may be null.