Search code examples
androidlauncherandroid-homebutton

Launcher that open the other launcher


I want to know if the user clicks on the Home button (like listen to Home button). Because I saw that is there now way to do that, I tough about an idea.

Maybe if I will create a launcher I will be able to handle to Home button...

But since I don't want to really create a launcher, so I want to create a launcher, that opens the previous one.

How can I create such a launcher? Or is it possible to use BroadcaseReceiver to listen to Home button?


Solution

  • HOME button can not be monitored nor reacted to and there is no workaround.

    As for the launcher:

    First, you would need to fetch the ResolveInfo for the current launcher and keep its package name somewhere, like SharedPreferences.

    Later, the user would have to accept your launcher as the default launcher. After that, you should make your launcher's onCreate() method's only job to create an intent which will open the previously saved package and then immediately call finish() on your launcher.

    However, I am pretty sure you will stumble upon some problem along the way, as this is Android. Anyway, be my guest to try and post the result here, the concept is really interesting.