The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.

Media Routes

Android can send audio and video to a variety of places, such as:

There is a common API for determining which of these “places” are available and allowing the user to choose which of these “places” should be used for a given bit of media. This common API centers around a MediaRouter, which is the focus of this chapter.


Understanding this chapter requires that you have read the core chapters of the book. In addition, you should read the chapters on advanced action bar techniques and the appcompat-v7 action bar backport.


First, we need to establish some common ground in terms of…, well, terms.


In this chapter, “media” refers to audio or video. This includes both media that may be stored on the device as well as media that may be streamed from some other source, frequently over the Internet.


A route indicates where media should be played. There are three categories of routes that concern us:


MediaRouter is the name of a class (actually, two classes) that know what routes are possible given the current environment and what routes are selected for the different categories (by default or by user choice).

A Tale of Two MediaRouters

The preview of this section was fed to a gremlin, after midnight.

Attaching to MediaRouter

The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.

User Route Selection with MediaRouteActionProvider

The preview of this section was lost in the sofa cushions.

Using Live Video Routes

The preview of this section was lost in the sofa cushions.

Using Remote Playback Routes

The preview of this section was eaten by a grue.