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.

Prerequisites

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

Terminology

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

DIY Chromecast

The preview of this section is sleeping in.

Creating the MediaRouteProvider

The preview of this section is presently indisposed.

Consuming the MediaRouteProvider

The preview of this section is off trying to sweet-talk the Khaleesi into providing us with a dragon.

Implementing This “For Realz”

The preview of this section was eaten by a grue.