Skip to content

Most visited

Recently visited

navigation
added in version 22.1.0
belongs to Maven artifact com.android.support:mediarouter-v7:27.0.0

MediaRouteProvider.RouteController

public static abstract class MediaRouteProvider.RouteController
extends Object

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


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() 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() method of its route controller. When the media route no longer needs the route controller it will invoke the 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.

Summary

Public constructors

MediaRouteProvider.RouteController()

Public methods

boolean onControlRequest(Intent intent, MediaRouter.ControlRequestCallback callback)

Performs a media control request asynchronously on behalf of the route.

void onRelease()

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

void onSelect()

Selects the route.

void onSetVolume(int volume)

Requests to set the volume of the route.

void onUnselect()

Unselects the route.

void onUnselect(int reason)

Unselects the route and provides a reason.

void onUpdateVolume(int delta)

Requests an incremental volume update for the route.

Inherited methods

From class java.lang.Object

Public constructors

MediaRouteProvider.RouteController

added in version 22.1.0
MediaRouteProvider.RouteController ()

Public methods

onControlRequest

added in version 22.1.0
boolean onControlRequest (Intent intent, 
                MediaRouter.ControlRequestCallback callback)

Performs a media control request asynchronously on behalf of the route.

Parameters
intent Intent: A media control intent.

callback MediaRouter.ControlRequestCallback: A MediaRouter.ControlRequestCallback to invoke with the result of the request, or null if no result is required.

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.

See also:

onRelease

added in version 22.1.0
void onRelease ()

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

onSelect

added in version 22.1.0
void onSelect ()

Selects the route.

onSetVolume

added in version 22.1.0
void onSetVolume (int volume)

Requests to set the volume of the route.

Parameters
volume int: The new volume value between 0 and getVolumeMax().

onUnselect

added in version 22.1.0
void onUnselect ()

Unselects the route.

onUnselect

added in version 22.1.0
void onUnselect (int reason)

Unselects the route and provides a reason. The default implementation calls onUnselect().

The reason provided will be one of the following:

Parameters
reason int: The reason for unselecting the route.

onUpdateVolume

added in version 22.1.0
void onUpdateVolume (int delta)

Requests an incremental volume update for the route.

Parameters
delta int: The delta to add to the current volume.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)