I was able to create an app to be the default launcher of my android device using this intent filter on the manifest file:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Everything works perfectly so once I click on the home button my app launches. The only problem I get is when I keep pressing repeatedly on back button (which I need to have it functional) I end up at Samsung default TouchWiz launcher.
My question is:
Is there any way to prevent my device from returning back to Samsung's TouchWiz default launcher?
I'm pretty sure that this is possible as I've seen different launchers on play store doing the same thing I want to achieve.
Regards.
After investigating on this matter i came up with a solution. The trick was to override the method onBackPressed()
of the Activity Class in the main activity of the launcher Android and just having it empty like so :
@Override
public void onBackPressed() {
//do nothing
}
By doing this, whenever we are on the launcher's main activity the user won't get back to the OS launcher because the Back Button have no action.