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.

Creating a MediaRouteProvider

As was noted earlier in the book, you can use MediaRouter to identify media routes, such as those published by devices like Google’s Chromecast. Specifically, remote playback routes let you write apps that tell other devices, like the Chromecast, to play back media on your behalf.

However, not only can you write clients for remote playback routes, you can write providers of those routes. Perhaps you are working with a hardware manufacturer that is creating a Chromecast-like device. Perhaps you want to allow your app, running on a Fire TV or an Android HDMI stick, to be controlled by a user’s phone or tablet. Or perhaps you are trying to tie Android into specialized media hardware that does not communicate by conventional means (e.g., wireless speakers that do not use normal Bluetooth profiles).

This chapter will outline how you can create code that will publish media routes to users of MediaRouter, so that you can then take those requests and forward them to a remote device.


This chapter assumes that you have read the chapter on MediaRouter.


For the purposes of this chapter:

DIY Chromecast

The preview of this section is in the process of being translated from its native Klingon.

Creating the MediaRouteProvider

The preview of this section is [REDACTED].

Consuming the MediaRouteProvider

The preview of this section was whisked away by a shark-infested tornado.

Implementing This “For Realz”

The preview of this section is in an invisible, microscopic font.