Langsung ke konten

Paling sering dikunjungi

Terakhir dikunjungi


Getting Started with TV Apps

TV apps use the same structure as those for phones and tablets. This similarity 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.

Important: Your app must meet specific requirements to qualify as an Android TV app on Google Play. For more information, see the requirements listed in TV App Quality.

This lesson describes how to prepare your development environment for building TV apps, and the minimum required changes to enable an app to run on TV devices.

Determine media format support

See the following documentation for information about the codecs, protocols, and formats supported by Android TV.

Set up a TV project

This section discusses how to modify an existing Android app to run on TV devices, or create a new app. If you have an existing Android app, adding Android TV support lets you design a user interface for TV while re-using your existing app architecture.

These are the main components you should use to create an app that runs on TV devices:


Before you begin building apps for TV, you must:

Declare a TV Activity

An application intended to run on TV devices must declare a launcher activity for TV in its manifest. It uses a CATEGORY_LEANBACK_LAUNCHER intent filter to do this. This filter identifies your app as being enabled for TV, and lets Google Play identify it as a TV app. When a user selects your app on their TV home screen, this intent identifies which activity to launch.

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

  android:banner="@drawable/banner" >
    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 this example specifies that activity as the one to launch on a TV device.

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

If you are modifying an existing app for use on TV, your app should not use the same activity layout for TV that it does for phones and tablets. Your TV app's user interface (or TV portion of your existing app) should provide a simpler interface for easy navigation using a remote control from a couch. For guidelines on designing an app for TV, see the TV Design guide. For more information on the minimum implementation requirements for interface layouts on TV, see Building Layouts for TV.

Declare Leanback support

Declare that your app uses the Leanback user interface required by Android TV. If you are developing an app that runs on mobile (phones, wearables, tablets, etc.) as well as Android TV, set the required attribute value to false. If you set the required attribute value to true, your app will run only on devices that use the Leanback UI.

    <uses-feature android:name=""
        android:required="false" />

Declare touchscreen not required

Applications that are intended to run on TV devices do not rely on touch screens for input. To make this clear, your TV app's manifest must declare that the android.hardware.touchscreen feature is not required. This setting identifies your app as being able to work on a TV device, and is required for your app to be considered a TV app in Google Play. The following code example shows how to include this manifest declaration:

    <uses-feature android:name="android.hardware.touchscreen"
              android:required="false" />

Caution: In your app manifest, you must declare that a touch screen is not required, as shown this example code; otherwise your app won't appear in Google Play on TV devices.

If an application includes a Leanback launcher intent filter, it must provide a home screen banner image for each localization. The banner is the app launch point that appears on the home screen in the apps and games rows. To add the banner to your app, describe the banner in the manifest as follows:

    android:banner="@drawable/banner" >


Use the android:banner attribute with the <application> tag to supply a default banner for all application activities, or with the <activity> tag to supply a banner for a specific activity.

The banner should be an xhdpi resource with a size of 320 x 180 px. Text must be included in the image. If your app is available in more than one language, you must provide separate versions of the banner with text for each supported language.

Change the launcher color

When a TV app launches, the system displays an animation that resembles an expanding, filled circle. To customize the color of this animation, set the android:colorPrimary attribute of your TV app or activity to a specific color. You should also set two additional transition overlap attributes to true, as shown in the following snippet from a theme resource XML file:

    <style ... >
      <item name="android:colorPrimary">@color/primary</item>
      <item name="android:windowAllowReturnTransitionOverlap">true</item>
      <item name="android:windowAllowEnterTransitionOverlap">true</item>

For more information about working with themes and styles, see Styles and Themes.

Add TV support libraries

The Android SDK includes support libraries for use with TV apps. These libraries provide APIs and user interface widgets for TV devices. The libraries, which are located in the <sdk>/extras/android/support/ directory, are as follows:

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. Thus, apps that use the leanback support library must include the following support libraries:

The v17 leanback library contains resources that require specific steps to include the library 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:

Run TV apps

Running your app is an important part of the development process. You can run your app on TV devices configured to support USB debugging, or use virtual TV devices.

Run on a real device

Set up your TV device as follows:

  1. Use a USB cable to connect your TV device to your development machine. If needed, refer to documentation provided by your device manufacturer.
  2. On your TV device, navigate to Settings.
  3. In the Device row, select About.
  4. Scroll down to Build and select Build several times until you get the message, "You are now a developer!"
  5. Return to Settings. In the Preferences row, select Developer options.
  6. Select Debugging > USB debugging and select On.
  7. Navigate back to the TV home screen.

To test your application on your TV device:

  1. In Android Studio, select your project and click Run from the toolbar.
  2. In the Select Deployment Target window, select your TV device, and click OK.

Run on a virtual device

The AVD Manager in the Android SDK provides the device definitions that allow you to create virtual TV devices for running and testing your applications.

To create a 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 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, where supported, use virtual device acceleration. For more information on the emulator's hardware acceleration, see Using the Emulator.

To test your application on the virtual TV device:

  1. In Android Studio, select your project and click Run from the toolbar.
  2. In the Select Deployment Target window, select your virtual TV device, and click OK.

For more information about using emulators, see Using the Emulator. For more information on deploying apps from Android Studio to virtual devices, see Debugging with Android Studio.

Situs ini menggunakan cookies untuk menyimpan preferensi Anda tentang bahasa di situs tertentu dan opsi tampilan.

Dapatkan berita dan tips terbaru dari developer Android yang akan membantu Anda mencapai kesuksesan di Google Play.

* Wajib Diisi


Ikuti Google Developers di WeChat

Buka situs ini dalam bahasa ?

Anda meminta halaman dalam bahasa , namun preferensi bahasa untuk situs ini adalah .

Ingin mengubah preferensi bahasa dan mengakses situs ini dalam bahasa ? Jika nanti Anda ingin mengubah preferensi bahasa, gunakan menu bahasa di bagian bawah setiap halaman.

Kelas ini memerlukan tingkat API atau yang lebih tinggi

Dokumen ini tersembunyi karena level API yang Anda pilih untuk dokumentasi ini adalah . Anda dapat mengubah level API dokumentasi dengan pemilih di atas menu navigasi sebelah kiri.

Untuk informasi lebih lanjut tentang menentukan level API yang diperlukan aplikasi Anda, baca Mendukung Versi Platform Yang Berbeda.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)