Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# BatchResultCallback

*** ** * ** ***

` public interface BatchResultCallback `   
` `

|---|
| android.app.appsearch.BatchResultCallback\<KeyType, ValueType\> |

<br />

*** ** * ** ***

The callback interface to return `https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult`.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/app/appsearch/BatchResultCallback#onResult(android.app.appsearch.AppSearchBatchResult<KeyType,ValueType>)(https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult<KeyType, ValueType> result) ` Called when `https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult` results are ready. |
| ` default void` | ` https://developer.android.com/reference/android/app/appsearch/BatchResultCallback#onSystemError(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable throwable) ` Called when a system error occurs. |

## Public methods

### onResult

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Called when `https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult` results are ready.

<br />

| Parameters ||
|---|---|
| `result` | `AppSearchBatchResult`: The result of the executed request. This value cannot be `null`. <br /> |

### onSystemError

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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 (for example 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 `https://developer.android.com/reference/android/app/appsearch/BatchResultCallback#onResult(android.app.appsearch.AppSearchBatchResult<KeyType,ValueType>)` method.

<br />

| Parameters ||
|---|---|
| `throwable` | `Throwable`: an exception describing the system error. This value may be `null`. <br /> |