Question

How to, when the application first started, lock on my application avoiding the event of any use of 'back' and 'home' button.
Only the application should have the ability to release the access to the device, the user is blocked to use his home or back button.

Is there any way, even if some hack is needed.

Sorry about breaking the freedom of Android, but it's a client specific need. He doesn't want his waiters kidding around with some Android's game.

Thank you.

Was it helpful?

Solution

For Back: override onBackPressed in your activity so that it doesn't call super.onBackPressed()

For the home button, check out this stack overflow thread.

OTHER TIPS

Fortunately, there isn't a reliable way to do this. On any given Android device, the user can simply reboot in safe mode (hold down the Home key during boot) to disable all 3rd party apps (which means your apps) and run the standard apps/uninstall 3rd party apps. Android was designed to ensure that the user remains in control of his device.

Maybe it will work for whatever your client requires, but just know that it can be easily bypassed if the user knows how. :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top