Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App to set as Launcher

What i had done: I have made a custom launcher that actually runs/sets as a home screen launcher upon load. Also it appears in the installed launchers list, which means everything is good so far.

What i want: But, when i launch/set my application as launcher and press back button, it goes to the previously set launcher screen.
It should not be like this i guess. It shall remain set like a home/default launcher of the device.

My Code Additions:
In my manifest i added following:

 <activity
        android:name=".Main"
        android:launchMode="singleTask"
        android:clearTaskOnLaunch="true"
        android:stateNotNeeded="true"
        android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>

            <!-- These two lines are setting it as a launcher-->
            <category android:name="android.intent.category.HOME"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>  

Any idea how i can achieve my goal ?

like image 763
Noman Avatar asked Nov 05 '14 11:11

Noman


People also ask

How do I set default app as launcher?

Change default Android launcherWith some Android phones you head to Settings > Home, and then you choose the launcher you want. With others you head to Settings > Apps and then hit the settings cog icon in the top corner where you'll then options to change default apps.

What is launcher app in Android?

An app launcher replaces the stock user interface for organizing the home screen and app icons predominantly in the Android world; however, they are also available for jailbroken iPhones (see iPhone jailbreaking and Cydia). See Launchpad and app drawer.


1 Answers

You are certainly welcome to intercept the BACK button in your activity, by overriding onBackPressed(), and preventing it from destroying the activity by simply not chaining to the superclass.

like image 96
CommonsWare Avatar answered Sep 23 '22 10:09

CommonsWare