This article is the first part of a tour around the Android platforms: Android TV, Wearable
Let’s get started with Android TV, a platform that was introduced at Google I/O in 2014. Android TV brings new capabilities to the big screen - it allows you to run Android apps and games directly on your TV devices. TV apps use the same structure as those for phones and tablets. You can simply modify an existing Android project to support Android TV. So let’s do that.
Caution: Google recommends having a single app that supports both mobile devices and TV devices. If you need
There are a couple of things to do before you get started. First, update the target API level to 21 (Android 5.0) and ensure that your Android build tool version is at least at version 24.0.0. Make sure that you sync
Let’s go to the Manifest file. Your app must declare a launcher activity with a specific intent filter.
<application android:banner="@drawable/banner" > ... <activity android:name="com.example.android.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.example.android.TvActivity" android:label="@string/app_name" android:theme="@style/Theme.Leanback"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> </application>
Caution: If an application includes a Leanback launcher intent filter, it must provide a home screen banner image. The banner is the app launcher icon on Android TV.
Android TV apps require a declaration of
Leanback is a support library for TV user interfaces that
If you want
If you are creating an Android TV application from scratch, you can skip the steps below. Android Studio will generate all the required components for you! Ignore the Working with existing code section and move straight to the Support TV hardware features section.
TV devices are different from other Android devices. You must be aware that such features as GPS, camera and even touch screen are not available on Android TV. If you modify your application which uses a specific feature, mark all these features as required=“false” in your Manifest file. Remember that some features have subfeatures that you must specify in your app, too. Please refer to the list of unsupported TV features for more details.
If you are not sure which features are available on your device, you can check it at runtime using hasSystemFeature(String).
Remember that the following permissions imply hardware features that Android TV does not support:
Do not forget to mark these features as required=“false” in your Manifest file!
TV devices use an external controller for interacting with
The most relevant usability requirements and best practices that we highlight are listed below. Your app must adhere to all of them in order to be qualified as a TV app. For more detailed information check out the official Android Developers website.