When the user clicks Home he is given the choice of launcher and he can also choose whether to set it as default. The problem is that afterwards it's hard to change it again.
To fix this I added a "Reset preferred launcher" that triggers this:
getPackageManager().clearPackagePreferredActivities(getPackageName());
However this line only resets the preferred launcher if he has chosen my launcher. I need a snippet that clears the preferred launcher whatever it is, so next time the user clicks home he is given the options again.
Alias activity will cause some problems like your launcher will provide two entry when picking up default launcher.
following is my solution, it works for me. how to make the Launcher-Pick-Up popup window showing?
It's not directly possible, and Android developers have stated that they do not want any app changing the user's preferences. However, there is a workaround based on how Android maintains these preferences.
Make your manifest look like this:
For the sake of simplicity, I've left out additional attributes that aren't relevant to the task at hand.
Anyway once your manifest looks like this, you can clear the default launcher using code like this:
By enabling one alias and disabling the other, you cause Android to perceive the user's options as having changed, as if you installed one launcher and uninstalled another. Thus, the user will be asked to choose again the next time they press the home button. This approach works no matter whose launcher is the current default.