Android TV does not start working properly

I have an application that should work both on the phone and on the TV. In the manifest, I indicate the activity of starting the phone with

<activity android:name=".view.phone.MainActivity" android:launchMode="singleTop" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> 

and the activity of starting the TV using

 <activity android:name=".view.leanback.MainActivity" android:launchMode="singleTop" android:label="@string/app_name" android:screenOrientation="landscape" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> 

Instead of filtering between LAUNCHER and LEANBACK_LAUNCHER, on any device it simply goes to the activity that was declared first in the manifest. Any ideas what I'm doing wrong?

+7
android android-tv android-manifest
source share
2 answers

The solution for me was to create 2 launch configurations as follows:

new configurations

How to configure

+3
source share

You use the same MainActivity activity MainActivity to call your TV and phone. Change one of these names and you should be good to go. As shown here in the first step, your activity name for the TV should be different from the name of your activity for the phone application.

0
source share

All Articles