# MediaRouteProvider.RouteController

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)   
belongs to Maven artifact com.android.support:mediarouter-v7:28.0.0-alpha1  
Summary: [Ctors](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#pubctors) \| [Methods](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#inhmethods) \| [\[Expand All\]](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#)  

# MediaRouteProvider.RouteController

| This package is part of the Android [support library](https://developer.android.com/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](https://developer.android.com/jetpack/androidx) which is part of [Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](https://developer.android.com/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class
| mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).


`
public
static

abstract
class
MediaRouteProvider.RouteController
`


`

extends Object


`

`


`

|---|-------------------------------------------------------------|
| java.lang.Object                                               ||
| ↳ | android.support.v7.media.MediaRouteProvider.RouteController |

<br />

*** ** * ** ***

Provides control over a particular route.


The media router obtains a route controller for a route whenever it needs
to control a route. When a route is selected, the media router invokes
the [onSelect()](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onSelect()) method of its route controller. While selected,
the media router may call other methods of the route controller to
request that it perform certain actions to the route. When a route is
unselected, the media router invokes the [onUnselect()](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onUnselect()) method of its
route controller. When the media route no longer needs the route controller
it will invoke the [onRelease()](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onRelease()) method to allow the route controller
to free its resources.


There may be multiple route controllers simultaneously active for the
same route. Each route controller will be released separately.


All operations on the route controller are asynchronous and
results are communicated via callbacks.

<br />

## Summary

|                                                                                  ### Public constructors                                                                                  ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[MediaRouteProvider.RouteController](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#MediaRouteProvider.RouteController())`() ` |

|                                                                                                                                                                                                                                                                                                                      ### Public methods                                                                                                                                                                                                                                                                                                                      ||
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean` | ` `[onControlRequest](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onControlRequest(android.content.Intent, android.support.v7.media.MediaRouter.ControlRequestCallback))`(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent, `[MediaRouter.ControlRequestCallback](https://developer.android.com/reference/android/support/v7/media/MediaRouter.ControlRequestCallback)` callback) ` Performs a [media control](https://developer.android.com/reference/android/support/v7/media/MediaControlIntent) request asynchronously on behalf of the route. |
| ` void`    | ` `[onRelease](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onRelease())`() ` Releases the route controller, allowing it to free its resources.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` void`    | ` `[onSelect](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onSelect())`() ` Selects the route.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` void`    | ` `[onSetVolume](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onSetVolume(int))`(int volume) ` Requests to set the volume of the route.                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` void`    | ` `[onUnselect](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onUnselect())`() ` Unselects the route.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` void`    | ` `[onUnselect](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onUnselect(int))`(int reason) ` Unselects the route and provides a reason.                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` void`    | ` `[onUpdateVolume](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onUpdateVolume(int))`(int delta) ` Requests an incremental volume update for the route.                                                                                                                                                                                                                                                                                                                                                                                                                                  |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#)From class ` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public constructors

### MediaRouteProvider.RouteController

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
MediaRouteProvider.RouteController ()
```

<br />

<br />

## Public methods

### onControlRequest

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onControlRequest (Intent intent, 
                MediaRouter.ControlRequestCallback callback)
```

Performs a [media control](https://developer.android.com/reference/android/support/v7/media/MediaControlIntent) request
asynchronously on behalf of the route.

<br />

|                                                                                                                                    Parameters                                                                                                                                    ||
|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `intent`   | `Intent`: A [media control intent](https://developer.android.com/reference/android/support/v7/media/MediaControlIntent). <br />                                                                                                                                      |
| `callback` | `MediaRouter.ControlRequestCallback`: A [MediaRouter.ControlRequestCallback](https://developer.android.com/reference/android/support/v7/media/MediaRouter.ControlRequestCallback) to invoke with the result of the request, or null if no result is required. <br /> |

|                                                                                                 Returns                                                                                                  ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | True if the controller intends to handle the request and will invoke the callback when finished. False if the controller will not handle the request and will not invoke the callback. <br /> |

**See also:**

- [MediaControlIntent](https://developer.android.com/reference/android/support/v7/media/MediaControlIntent)  

### onRelease

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onRelease ()
```

Releases the route controller, allowing it to free its resources.

<br />

### onSelect

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onSelect ()
```

Selects the route.

<br />

### onSetVolume

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onSetVolume (int volume)
```

Requests to set the volume of the route.

<br />

|                                                                                     Parameters                                                                                     ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `volume` | `int`: The new volume value between 0 and [getVolumeMax()](https://developer.android.com/reference/android/support/v7/media/MediaRouteDescriptor#getVolumeMax()). <br /> |

### onUnselect

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onUnselect ()
```

Unselects the route.

<br />

### onUnselect

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onUnselect (int reason)
```

Unselects the route and provides a reason. The default implementation
calls [onUnselect()](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController#onUnselect()).


The reason provided will be one of the following:

- [UNSELECT_REASON_UNKNOWN](https://developer.android.com/reference/android/support/v7/media/MediaRouter#UNSELECT_REASON_UNKNOWN)
- [UNSELECT_REASON_DISCONNECTED](https://developer.android.com/reference/android/support/v7/media/MediaRouter#UNSELECT_REASON_DISCONNECTED)
- [UNSELECT_REASON_STOPPED](https://developer.android.com/reference/android/support/v7/media/MediaRouter#UNSELECT_REASON_STOPPED)
- [UNSELECT_REASON_ROUTE_CHANGED](https://developer.android.com/reference/android/support/v7/media/MediaRouter#UNSELECT_REASON_ROUTE_CHANGED)

<br />

<br />

|                          Parameters                           ||
|----------|-----------------------------------------------------|
| `reason` | `int`: The reason for unselecting the route. <br /> |

### onUpdateVolume

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onUpdateVolume (int delta)
```

Requests an incremental volume update for the route.

<br />

|                           Parameters                           ||
|---------|-------------------------------------------------------|
| `delta` | `int`: The delta to add to the current volume. <br /> |

-

  ## Interfaces

  - [RemotePlaybackClient.OnMessageReceivedListener](https://developer.android.com/reference/android/support/v7/media/RemotePlaybackClient.OnMessageReceivedListener)
-

  ## Classes

  - [MediaControlIntent](https://developer.android.com/reference/android/support/v7/media/MediaControlIntent)
  - [MediaItemMetadata](https://developer.android.com/reference/android/support/v7/media/MediaItemMetadata)
  - [MediaItemStatus](https://developer.android.com/reference/android/support/v7/media/MediaItemStatus)
  - [MediaItemStatus.Builder](https://developer.android.com/reference/android/support/v7/media/MediaItemStatus.Builder)
  - [MediaRouteDescriptor](https://developer.android.com/reference/android/support/v7/media/MediaRouteDescriptor)
  - [MediaRouteDescriptor.Builder](https://developer.android.com/reference/android/support/v7/media/MediaRouteDescriptor.Builder)
  - [MediaRouteDiscoveryRequest](https://developer.android.com/reference/android/support/v7/media/MediaRouteDiscoveryRequest)
  - [MediaRouteProvider](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider)
  - [MediaRouteProvider.Callback](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.Callback)
  - [MediaRouteProvider.ProviderMetadata](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.ProviderMetadata)
  - [MediaRouteProvider.RouteController](https://developer.android.com/reference/android/support/v7/media/MediaRouteProvider.RouteController)
  - [MediaRouteProviderDescriptor](https://developer.android.com/reference/android/support/v7/media/MediaRouteProviderDescriptor)
  - [MediaRouteProviderDescriptor.Builder](https://developer.android.com/reference/android/support/v7/media/MediaRouteProviderDescriptor.Builder)
  - [MediaRouteProviderService](https://developer.android.com/reference/android/support/v7/media/MediaRouteProviderService)
  - [MediaRouter](https://developer.android.com/reference/android/support/v7/media/MediaRouter)
  - [MediaRouter.Callback](https://developer.android.com/reference/android/support/v7/media/MediaRouter.Callback)
  - [MediaRouter.ControlRequestCallback](https://developer.android.com/reference/android/support/v7/media/MediaRouter.ControlRequestCallback)
  - [MediaRouter.ProviderInfo](https://developer.android.com/reference/android/support/v7/media/MediaRouter.ProviderInfo)
  - [MediaRouter.RouteInfo](https://developer.android.com/reference/android/support/v7/media/MediaRouter.RouteInfo)
  - [MediaRouteSelector](https://developer.android.com/reference/android/support/v7/media/MediaRouteSelector)
  - [MediaRouteSelector.Builder](https://developer.android.com/reference/android/support/v7/media/MediaRouteSelector.Builder)
  - [MediaSessionStatus](https://developer.android.com/reference/android/support/v7/media/MediaSessionStatus)
  - [MediaSessionStatus.Builder](https://developer.android.com/reference/android/support/v7/media/MediaSessionStatus.Builder)
  - [RemotePlaybackClient](https://developer.android.com/reference/android/support/v7/media/RemotePlaybackClient)
  - [RemotePlaybackClient.ActionCallback](https://developer.android.com/reference/android/support/v7/media/RemotePlaybackClient.ActionCallback)
  - [RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/android/support/v7/media/RemotePlaybackClient.ItemActionCallback)
  - [RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/android/support/v7/media/RemotePlaybackClient.SessionActionCallback)
  - [RemotePlaybackClient.StatusCallback](https://developer.android.com/reference/android/support/v7/media/RemotePlaybackClient.StatusCallback)