Routing between devices

As users connect their televisions, home theater systems, and music players with wireless
technologies, they want to be able to play content from Android apps on these larger,
louder devices. Enabling this kind of playback can turn your one-device, one-user app
into a shared experience that delights and inspires multiple users.

The Android media router APIs are designed to enable media display and playback on
remote receiver devices using a common user interface. App developers that
implement a MediaRouter interface can then connect to the
framework and play content to devices that participate in the media router framework. Media
playback device manufacturers can participate in the framework by publishing a MediaRouteProvider that allows other applications to connect to and
play media on the receiver devices. Figure 1 illustrates how an app connects to a receiver
device through the media router framework.

Figure 1. Overview of how media route provider classes provide communication
from a media app to a receiver device.

Note: If you want your app to support
Google Cast devices,
you should use the Cast SDK
and build your app as a Cast sender. Follow the directions in the
Cast documentation
instead of using the MediaRouter framework directly.

Mediarouter support library

The mediarouter APIs are defined in the
v7-mediarouter support library.
This library is compatible with devices running Android 2.3 (API level 9) and higher and ensures a consistent
experience across all of them.
For detailed information about the mediarouter APIs, see the android.support.v7.media
package in the API reference.