0

I want my app to execute a piece of code whenever the homebutton is pressed. This should also happen, when the app itself isn't currently open. I have found a way to do this with volume buttons:

How can I launch an android app on upon pressing the volume up or volume down button?

But I need it to work with the home button. Setting the app as a launcher doesn't work, as it won't work on the lockscreen then.

Tomhawk
  • 188
  • 8
  • This is not possible, sorry. – CommonsWare Nov 13 '17 at 22:00
  • But why do you want to do that? – Eselfar Nov 14 '17 at 00:11
  • @Eselfar my friend has a phone with a virtual home button. He asked me if there was a way I could make it taptic (so vibrate if he presses it, just like the iPhone), but there is no setting for it. – Tomhawk Nov 14 '17 at 21:26
  • You can do Settings -> Sound -> Vibrate on tap. It activates vibrations when you press anything (so not the home button only so I don't know if this is what your friend is looking for). But otherwise you can't do that with an app, you need to modify the system itself. – Eselfar Nov 15 '17 at 09:58

0 Answers0