Reputation: 91
I did in Manifest.xml file
<!-- Start For Android Tv Box-->
<uses-feature
android:name="android.software.leanback"
android:required="true" />
<uses-feature
android:name="android.software.live_tv"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<!-- End For Android Tv Box-->
MainActivity is my first activity which is the firest screen of my app.
<activity
android:name=".MainActivity"
android:hardwareAccelerated="false"
android:screenOrientation="landscape"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
android:launchMode="singleInstance"
android:autoRemoveFromRecents="true"
android:resumeWhilePausing="true"
android:resizeableActivity="true"
tools:targetApi="n">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<meta-data android:name="supports_leanback" android:value="true" />
</activity>
When user tapped on Home button of AndroidTv remote Home/Launcher popup should come up and choose a launcher app for AndroidTv device, then whenever user power on device my app should be come as a launcher app.
Upvotes: 1
Views: 1502
Reputation: 862
Making an app as the launcher in Android TV is the same as other android devices. You only need to add a category named android.intent.category.HOME
in your activiy's intent-filter. Use the following lines to change your AndroidManifest.xml
:
<activity
android:name=".MainActivity"
...>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
...
</intent-filter>
</activity>
Upvotes: 0