Google TV

Channel Changing

Any Google TV Android application can change the TV channel programmatically. To do this, the app calls startActivity() with an Android Intent object set to the action ACTION_VIEW. The data in the Intent is a Uri object containing the URI for the desired channel. You can retrieve a URI for desired channel by querying the Channel Listing Provider, as described in the previous section..

Notice that this Intent does not specify a component name, By default, this Intent is handled by the Live TV player, which is part of the Google TV platform. If you want, you can declare an intent filter for this Intent in your Google TV application's manifest (AndroidManifest.xml). You can then offer your application as an alternative for handling the Intent.

Here is a code snippet that demonstrates how to create the Intent and use it to tune to a TV channel:

import android.content.Intent:
import android.net.Uri;
import android.app.Activity;

// Variables
Intent mViewIntent;
Uri mUri;

...

// Creates a new Intent object with the ACTION_VIEW action
Intent mViewIntent = new Intent(Intent.ACTION_VIEW);

/*
 * Put your own code here to form a channel URI string and
 * convert it to a Uri object in the variable mUri
 * Channel URIs can be retrieved from the Channel Listing Content Provider
 * as described in the previous section.
 */

...

// This code assumes that the channel URI is now in mUri
// Sets the channel Uri as the data for the Intent
mViewIntent.setData(mUri);

/*
 * Starts an Activity that can handle ACTION_VIEW and
 * understands channel URIs. Live TV Player is the default
 * app for this.
 */
startActivity(mViewIntent); 

For a more detailed example, please check out the Channel Changing sample application.

To learn more about Intent objects and intent filters, please read the topic Intents and Intent Filters in the Android Developers Guide.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.