Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TV not starting correct activity

I have an app that should run on both phone and TV. In the manifest, I'm specifying the phone's launch activity 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 TV's launch activity with

<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 & LEANBACK_LAUNCHER, on either device it just goes with whichever activity is declared first in the manifest. Any ideas what I'm doing wrong?

like image 634
Tim Mutton Avatar asked Mar 30 '15 22:03

Tim Mutton


Video Answer


1 Answers

Solution for me was to create 2 launch configuration like this:

new configurations

How to configure

like image 112
Pauland Avatar answered Sep 30 '22 03:09

Pauland