-1

in my application i need to lock home button i want to use in Jelly Bean OS version i have used code which is in below url but using this when i press home button then open one popup and display 2 icon 1)Activity name and 2) Launcher but i want to do nothing in home button and stay in same activity, if anybody know then please help me.

https://developer.motorolasolutions.com/thread/1163

Thanks

Ketan
  • 387
  • 2
  • 7

2 Answers2

1

It is impossible to detect and/or intercept the HOME button from within an Android app. This is built into the system to prevent malicious apps that cannot be exited. or Have u gone through this? detect home button press

I m not the author , but came across it recently. hope it helps you!

M D
  • 47,665
  • 9
  • 93
  • 114
0

Post ICS i.e. Android 4+, the overriding of the HomeButton has been removed for security reasons.

It is not a really good practice to not let the user navigate away from the application. But, since you are making a lock screen application, what you can do is declare the activity as a Launcher , so that when the HomeButton is pressed it will simply restart your application and remain there itself (the users would notice nothing but a slight flicker in the screen).

Hulk
  • 2,565
  • 16
  • 24