How to make an app use a different banner for Android TV?

Viewed 2371

An app uses the banner as follows:

<application
    ...
    android:banner="@mipmap/ic_launcher" >
    ...
</application>

Android Studio's Asset Studio was used to create the banner: enter image description here

It works exactly as expected.

Since Android TV apps have different requirements for the banner, is there a way to specify a banner only for Android TVs without affecting other devices?

[Edit]

I appreciate the answers suggesting using a different activity. The current launch activity is very TV-friendly. I want to use the same activity. I was looking for a way to allow the app to use a different set of resources automatically on an Android TV. If that is not possible, I will take the answer by creating a dummy activity that switches to the original launch activity automatically.

4 Answers

Mobile devices use the icon and TV devices use the banner, so you can point these to separate resources:

<application
    android:icon="@mipmap/ic_launcher"
    android:banner="@mipmap/ic_app_banner"
    ...

Step1: create a separate Activity for Android TV

Step2: provide a default banner for that Activity with the tag

<activity
 ...
android:banner="@mipmap/ic_launcher">
</activity>

As the official documentation states and I quote:

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.

You can use <activity> tag to use different banners.

All the answers have given me some hints. Here is my final solution that has been accepted by Google Play. In AndroidManifest.xml, specify the icon for phones and tablets for application tag. (android:icon="@mipmap/ic_launcher"). It has to be done. Otherwise, the app would crash.

<application
    android:name="androidx.multidex.MultiDexApplication"
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher_round"
    android:largeHeap="true"
    android:requestLegacyExternalStorage="true"
    android:usesCleartextTraffic="true"
    tools:replace="android:theme, android:label">

Here is the key: android:icon="@mipmap/ic_launcher_round" for phones and tablets and android:banner="@mipmap/ic_banner" for Android TV in the activity tag of the launcher activity:

<activity
    android:name=".OnviferActivity"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:icon="@mipmap/ic_launcher_round"
    android:banner="@mipmap/ic_banner"
    android:label="@string/app_name"
    android:screenOrientation="@integer/screen_orientation">

Phones and tablets will use ic_launcher_round and Android TVs will use ic_banner automatically.

Related