Disable Home button in Android 4.0+

user538565 picture user538565 · Mar 17, 2013 · Viewed 20.3k times · Source

I'm trying to replace the stock lock screen with my own app.
In my code, i want to disable the Home button.
I know how to do this in Android 2.3 and below,
but the same code doesn't work with Android 4.0+ (return to desktop when Home button pressed)

Recently I found out an app called MiHome which has its own lock screen and is able to disable the Home button.
Does anyone know how it achieves this???

Answer

Raghunandan picture Raghunandan · Mar 17, 2013

There is no way to intercept the home button on Android, unless you make your app the home screen. This is for security reasons, so that malicious apps cannot take over your device by overriding all the buttons that can exit. The home button is the one sure shot way to be able to leave any app.

If you want to handle the HOME button, implement a home screen.