Added in API level 31

BatchResultCallback

interface BatchResultCallback<KeyType : Any!, ValueType : Any!>
android.app.appsearch.BatchResultCallback

The callback interface to return AppSearchBatchResult.

Summary

Public methods
abstract Unit
onResult(result: AppSearchBatchResult<KeyType, ValueType>)

Called when AppSearchBatchResult results are ready.

open Unit
onSystemError(throwable: Throwable?)

Called when a system error occurs.

Public methods

onResult

Added in API level 31
abstract fun onResult(result: AppSearchBatchResult<KeyType, ValueType>): Unit

Called when AppSearchBatchResult results are ready.

Parameters
result AppSearchBatchResult<KeyType, ValueType>: The result of the executed request. This value cannot be null.

onSystemError

Added in API level 31
open fun onSystemError(throwable: Throwable?): Unit

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

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