Android SDK Chromecast

Adding support for Chromecast

In order to enable chromecast, a few extra steps need and can be taken. These steps are described below.

1 Steps to enable Chromecast:

  1. Upgrade to the latest THEOplayer Android SDK release (≥ 1.0.9)
  2. To add chromecast support the first thing you need is to include the Cast Framework and Media Router libraries under the dependencies node in your build.gradle file.
    compile ''
    compile ''
  3. To enable chromecast on android a CastOptionsProvider should be specified. This class contains the configuration for chromecast on Android. A DefaultCastOptionsProvider is provided as part of the THEOplayer Android SDK. This OptionsProvider associates the THEOplayer chromecast receiver with your sender application. You will need to register this class in your AndroidManifest.xml file within a meta-data tag under your application node.
    If you need custom settings for your chromecast (for example a custom receiver id) you can create your own CastOptionsProvider by subclassing and implementing the getCastOptions method.
    public CastOptions getCastOptions(Context context) {
            return new CastOptions.Builder()

2 Optional extra steps:

2.1 Add routing button to your app:

In order to get this button to appear in your application's Toolbar, the easiest way is to include it in the menu XML file for your Activity.

  1. In your res folder add a menu folder
  2. Add a file
  3. Add the following contents to this file
    <?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android=""
        app:showAsAction="always" />
  4. Initialize this new MenuItem in the onCreateOptionsMenu method of your Activity (Make sure you have an AppCompatActivity).
    public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(, menu);
            return true;

2.2 Add MiniController to your app:

  1. In your main activity xml add the following fragment
            class="" />