Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [Ad Services Extensions 10](https://developer.android.com/sdkExtensions)   
Deprecated in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# AdServicesOutcomeReceiver

*** ** * ** ***

` public interface AdServicesOutcomeReceiver `   
` `

|---|
| android.adservices.common.AdServicesOutcomeReceiver\<R, E extends [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable)\> |

<br />

*** ** * ** ***

<br />

**This interface was deprecated in API level 36.**   

The Rubidium (Rb) Relevance APIs, including those in android.adservices.common, are being deprecated. Relevance APIs have no direct replacement. Developers should stop using them, as calls will be rejected in future Android releases. Please refer to official Privacy Sandbox documentation for deprecation and roadmap details: https://privacysandbox.com/news/update-on-plans-for-privacy-sandbox-technologies/

Callback interface intended for use when an asynchronous operation may result in a failure. Exact copy of the `https://developer.android.com/reference/android/os/OutcomeReceiver` class, re-defined in the AdServices package for backwards compatibility to Android R.

This interface may be used in cases where an asynchronous API may complete either with a value or with a `https://developer.android.com/reference/java/lang/Throwable` that indicates an error.

## Summary

| ### Public methods ||
|---|---|
| ` default void` | ` https://developer.android.com/reference/android/adservices/common/AdServicesOutcomeReceiver#onError(E)(E error) ` Called when the asynchronous operation fails. |
| ` abstract void` | ` https://developer.android.com/reference/android/adservices/common/AdServicesOutcomeReceiver#onResult(R)(R result) ` Called when the asynchronous operation succeeds and delivers a result value. |

## Public methods

### onError

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [Ad Services Extensions 10](https://developer.android.com/sdkExtensions)   
Deprecated in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onError (E error)
```

Called when the asynchronous operation fails. The mode of failure is indicated by the `https://developer.android.com/reference/java/lang/Throwable` passed as an argument to this method.

<br />

| Parameters ||
|---|---|
| `error` | `E`: A subclass of `https://developer.android.com/reference/java/lang/Throwable` with more details about the error that occurred. This value cannot be `null`. <br /> |

### onResult

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [Ad Services Extensions 10](https://developer.android.com/sdkExtensions)   
Deprecated in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onResult (R result)
```

Called when the asynchronous operation succeeds and delivers a result value.

<br />

| Parameters ||
|---|---|
| `result` | `R`: The value delivered by the asynchronous operation. <br /> |