# MediaRouter.ControlRequestCallback

Artifact: [androidx.mediarouter:mediarouter](https://developer.android.com/jetpack/androidx/releases/mediarouter) [View Source](https://cs.android.com/search?q=file:androidx/mediarouter/media/MediaRouter.java+class:androidx.mediarouter.media.MediaRouter.ControlRequestCallback) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

*** ** * ** ***


```
public abstract class MediaRouter.ControlRequestCallback
```

<br />

*** ** * ** ***

Callback which is invoked with the result of a media control request.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/mediarouter/media/MediaRouter.RouteInfo#sendControlRequest(android.content.Intent,androidx.mediarouter.media.MediaRouter.ControlRequestCallback)` |   |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/mediarouter/media/MediaRouter.ControlRequestCallback#ControlRequestCallback()()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/mediarouter/media/MediaRouter.ControlRequestCallback#onError(java.lang.String,android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html error, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html data)` Called when a media control request fails. |
| `void` | `https://developer.android.com/reference/androidx/mediarouter/media/MediaRouter.ControlRequestCallback#onResult(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html data)` Called when a media control request succeeds. |

## Public constructors

### ControlRequestCallback

Added in 1.1.0

```
public ControlRequestCallback()
```

## Public methods

### onError

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

```
public void onError(@Nullable String error, @Nullable Bundle data)
```

Called when a media control request fails.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html error` | A localized error message which may be shown to the user, or null if the cause of the error is unclear. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html data` | Error data, or null if none. Contents depend on the `https://developer.android.com/reference/androidx/mediarouter/media/MediaControlIntent`. |

### onResult

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

```
public void onResult(@Nullable Bundle data)
```

Called when a media control request succeeds.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html data` | Result data, or null if none. Contents depend on the `https://developer.android.com/reference/androidx/mediarouter/media/MediaControlIntent`. |