Get Started with TV Apps

This guide describes how to prepare your development environment and projects for building TV apps, including updating your existing app to run on TV devices.


Before you begin setting up to build apps for TV, you must:

  • Set up the Preview SDK
    The preview SDK provides the developer tools needed to build and test apps for TV.
  • Create a Preview SDK Project
    In order to access new APIs for TV devices, you must create a project that targets the preview release level or modify an existing project to target the preview release.

Set up a TV Project

TV apps use the same structure as those for phones and tablets. This means you can modify your existing apps to also run on TV devices or create new apps based on what you already know about building apps for Android. This section discusses how to modify an existing app, or create a new one, to run on TV devices.

These are the main steps to creating an app that runs on TV devices. Only the first is required:

  • Activity for TV - (Required) In your application manifest, you must declare an activity that is intended to run on TV devices.
  • TV Support Libraries - (Optional) There are several Support Libraries available for TV devices that provide widgets for building user interfaces.

Create a TV Activity

An application intended to run on TV devices must declare a launcher activity for TV in its manifest using a android.intent.category.LEANBACK_LAUNCHER intent filter. This filter identifies your app as being built for TV, enabling it to be displayed in the Google Play store app running on TV devices. Declaring this intent also identifies which activity in your app should be launched when a user selects its icon on the TV home screen.

Caution: If you do not include the LEANBACK_LAUNCHER intent filter in your app, it is not visible to users running the Google Play store on TV devices. Also, if your app does not have this filter when you load it onto a TV device using developer tools, the app does not appear in the TV user interface.

The following code snippet shows how to include this intent filter in your manifest:

    android:label="@string/app_name" >

      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />


      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LEANBACK_LAUNCHER" />


The second activity manifest entry in the example above specifies that activity as the main one when your app launches on an TV device.

If you have an existing app that you are modifying for TV use, your app should not use the same activity layout for TV that it does for phones and tablets. The user interface of your TV app (or TV portion of your existing app) should provide a simpler interface that can be easily navigated using a remote control from a couch. For guidelines on designing an app for TV, see the TV Design guide. For more instructions on developing a user interface appropriate to TV, see the TV User Interface guide.

Add TV Support Libraries

The Preview SDK includes support libraries that are intended for use with TV apps. These libraries provide APIs and user interface widgets for use on TV devices. The libraries are located in the <sdk>/extras/android/support/ directory where you installed the Preview SDK. Here is a list of the libraries and their general purpose:

  • v17 leanback library - Provides user interface widgets for TV, including BrowseFragment, DetailsFragment, and SearchFragment.
    • SDK location: <sdk>/extras/android/support/v17/leanback
    • Gradle dependency:
    • Contains resources: Yes
  • v7 recyclerview library - Provides classes for managing display of long lists in a memory efficient manner. Several classes in the v17 leanback library depend on the classes in this library.
    • SDK location: <sdk>/extras/android/support/v7/recyclerview
    • Gradle dependency:
    • Contains resources: No

Note: You are not required to use these support libraries for your TV app. However, we strongly recommend using them, particularly for apps that provide a media catalog browsing interface.

If you decide to use the v17 leanback library for your app, you should note that it is dependent on the v4 support library. This means that apps that use the leanback support library should include all of these support libraries:

  • v17 leanback support library
  • v7 recyclerview support library
  • v4 support library

The v17 leanback library contain resources, which requires you to take specific steps to include it in app projects. For instructions on importing a support library with resources, see Support Library Setup.

Build TV Apps

After you have completed the steps described above, it's time to start building apps for the big screen! Check out these additional topics to help you build your app for TV:

  • User Interface - The user interface of TV devices is different from those of other Android devices. See this topic to find out how to build TV user interfaces and to learn about the widgets provided to simplify that task.
  • Games for TV - TV devices are great platforms for games. See this topic for information on building great game experiences for TV.
  • Hardware features - TV devices do not contain hardware features normally found on other Android devices. See this topic for information on unsupported hardware features and what to do about them.

Run TV Apps

Running your app is an important part of the development process. The AVD Manager in the Android SDK provides the device definitions that allows you to create virtual TV devices for running and testing your applications.

To create an virtual TV device:

  1. Start the AVD Manager. For more information, see the AVD Manager help.
  2. In the AVD Manager dialog, click the Device Definitions tab.
  3. Select one of the Android TV device definitions, such as Large Android TV, and click Create AVD.
  4. Select the emulator options and click OK to create the AVD.

    Note: For best performance of the TV emulator device, enable the Use Host GPU option and CPU platform image that supports hardware acceleration. For more information on hardware acceleration of the emulator, see Using the Emulator.

To test your application on the virtual TV device:

  1. Compile your TV application in your development environment.
  2. Run the application from your development environment and choose the TV virtual device as the target.

For more information about using emulators see, Using the Emulator. For more information about deploying apps to emulators from Eclipse with ADT, see Building and Running from Eclipse with ADT.