Doomsknight Doomsknight - 5 months ago 42
Android Question

Manifest for home intent and launcher intent

What I have done is made a home screen application. Aka when you press home, it goes back to my app.

What I am struggling with though, is adding a normal launcher side to it, aka making it appear as an app in the apps menu. My intention is to create a simple screen that tells you and provides button access to change the home default settings. A wizard/setup guide in effect.

However, I am not sure how to have both together in one app, as it is something new to me.

The home bit works, it is the second activity that doesnt.

Manifest:

<activity
android:name=".HomeActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".LauncherActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

Answer

Add the android.intent.action.MAIN inside the LauncherActivity Intent filter so it looks like this

 <activity
        android:name=".HomeActivity"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:theme="@style/FullscreenTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.HOME"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>
    <activity android:name=".LauncherActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>