0

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?

nrofis
  • 8,975
  • 14
  • 58
  • 113

1 Answers1

1

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.

Kelevandos
  • 7,024
  • 2
  • 29
  • 46
  • I have tried it now, its not working well (its looks ugly). Maybe is there a way to track Home button with rooted device? I want to capture the Home button double click event. – nrofis Dec 11 '14 at 14:39
  • If I remember correctly you CAN track it, but only with system signature permission. And only a device manufacturer can assign such signature, for a specific device type (no way of emulating it for debug). Apart from that, it is one of the most secure parts of the android system core. – Kelevandos Dec 11 '14 at 14:43
  • I see... So maybe I will need to think about other type of event :( – nrofis Dec 11 '14 at 14:54
  • If you find the answer satisfying, please mark it as correct. Thanks! :-) – Kelevandos Dec 11 '14 at 14:56