Design guide

This section will point you to general Android TV™ topics you need to be aware of, in addition to Sony specific features you optionally can take advantage of.

Basic style of Android Manifest

The Android Manifest is a file located inside the app which presents essential information about your app to the Android system. The information in the file is also used in Google Play to filter the compatible apps for each devices. Developers can identify the features or libraries to declare which devices are compatible for the app. This enables the developer to control the app distributions in Google Play by using Android Manifest declarations.

Google offers new attributes to identify that your app has compatibility with Android TV devices. Please check the Android Manifest sample below before you start developing your app for TV.

 <!-- 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.software.leanback"
        android:required="false" />

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

    <!-- banner image (320x180px) must be set if it includes leanback launcher intent filter-->
    <application
        android:banner="@drawable/banner">

        <activity android:name="com.example.android.TvActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.Leanback">

            <!-- LEANBACK_LAUNCHER must be declared to make your
                app visible on TV Launcher -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>

        </activity>

    </application>

In addition to above, Android TV™ supports only landscape mode, and Google Play filters out the app even if the app contains a single declaration of an unsupported screenOrientation mode.

Unsupported screenOrientation modes include:

  • portrait
  • reversePortrait
  • sensorPortrait
  • userPortrait
  • reverseLandscape

Games

For games to correctly appear in the Games row and to indicate if a game supports gamepads, the following declarations should be included in the Android Manifest.

...
<!—- declare gamepad false if the game uses, but not requires a game controller -->
    <uses-feature android:name="android.hardware.gamepad" android:required="false"/>
    ...

    <application ...>
        ...
        <!-– Set isGame=true to put the app in Game row -->
        <android:isGame=“true”>
        ...
    </application>

Hardware features

Android TV™ has different hardware capabilities than smartphones or tablets. For this reason, the Android TV system and the Google Play store rejects the app if it requires the unsupported hardware features below:

  • Touchscreen (android.hardware.touchscreen)
  • Touchscreen emulator (android.hardware.faketouch)
  • Telephony (android.hardware.telephony)
  • Camera (android.hardware.camera)
  • Near Field Communications (NFC) (android.hardware.nfc)
  • GPS (android.hardware.location.gps)
  • Sensors (android.hardware.sensor)

For more information, refer to the details in the Android Developer pages.

If your app uses hardware that is not available on TV, but can operate without the use of those features, you can modify your app’s manifest to indicate that these features are not required by your app.

...
<!—- required=true stands for unsupported on TV
     required=false stands for supported on both TV and other devices -->
    <uses-feature android:name="android.hardware.telephony" android:required="false"/>
    ...

Identify the running device

To identify the running device, follow the steps below.

Identify Android TV™ device

The easiest way to determine if a device is a TV type device, is to use the UiModeManager method.

    final UiModeManager mode = (UiModeManager)getSystemService(UI_MODE_SERVICE);
    if (mode.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
        // do something for TV
    }

Identify BRAVIA Android TVs

To identify a BRAVIA Android TV™, developers can read the value of android.os.Build.

Build* Value of BRAVIA Android TVs
2K model 4K model (*1)
MODEL BRAVIA 2015 BRAVIA 4K 2015 BRAVIA 4K GB (*2)
MANUFACTURER Sony
BRAND Sony

*1. 4K lineups include various platforms with different MODEL names.
*2. This value will be applied for X83D, X80D, S80D, X75D and X70D series.
See the latest BRAVIA lineup.

    final boolean isBravia = android.os.Build.MODEL.contains("BRAVIA");
    if (isBravia) {
        // do something for BRAVIA
    }
    final PackageManager pm = getPackageManager();
    final boolean isBravia = pm.hasSystemFeature(“com.sony.dtv”);
    if (isBravia) {
        // do something for BRAVIA
    }

UI graphics on 2K or 4K display

BRAVIA TV provides 2K (1920×1080[px]) and 4K (3840×2160[px]) display resolutions. However both systems allow only 2K UI graphics, and UI graphics are upscaled from 2K to 4K by the platform in the case of 4K display TVs. This means that all BRAVIA TVs are  allowed only a single type of screen density for the UI graphic plane, which is “DENSITY_XHIGH”. Developers cannot create a dedicated “4K-App” which contains 4K graphics.

More details on screen types are available in the following Android Developers links:

To separate the operation programmatically for 2K/4K display TVs on BRAVIA, refer to the following code example.

    final PackageManager pm = getPackageManager();
    final boolean is4k = pm.hasSystemFeature("com.sony.dtv.hardware.panel.qfhd");
    if (is4k) {
        // do something for 4K display BRAVIA
    }

*Update system image on the BRAVIA before using the feature.

Google, Google Play, Android and other marks are trademarks of Google Inc.
Android TV is a trademark of Google Inc.
“SONY” and “BRAVIA” are trademarks of Sony Corporation.

Comments 0

Sort by:

Showing 0 of 0 comments. Show all comments