0

I am developing an app and I need to disable the home button or change his behavior on clicking a button how can I do it? I have already tried to use the onKeyDown event and other events

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
  • you cannot override the home button – tyczj Aug 05 '15 at 14:48
  • I can't block him or something? I want to prevent the user from closing the app – yoav magid Aug 05 '15 at 14:50
  • no you cant do anything with it at all. the home button is the only way that a user can guarantee they can leave an app. If an app could override the home button and the back button a rogue app could prevent the user from ever leaving the app – tyczj Aug 05 '15 at 14:52
  • I wanted to do that and ended by blocking any other application with some app lockers available on the store (no need to write code for that, other applications do it pretty well). It's not perfect, but Android doesn't provide a way to override this button. – leb1755 Aug 05 '15 at 14:56
  • But I managed to do it. On phones that the home button is not touch. but on phones that the home button is touch it's only lock the back button – yoav magid Aug 05 '15 at 14:57
  • please just search, there are plenty of people that asked this and everyone of those questions they say you cannot do it – tyczj Aug 05 '15 at 15:16
  • Those guys who try to override back button as well as home button. I think they are crazy developer who create annoying app's. – Aawaz Gyawali Aug 05 '15 at 16:05
  • but my app is not annoying it supposed to help to people – yoav magid Aug 05 '15 at 17:04

1 Answers1

0

You cannot block the Home button from sending intent android.intent.category.HOME which switches to the launcher but you can set your window to be always on top so the launcher won't be shown.

StenSoft
  • 9,369
  • 25
  • 30