How to lock the phone only in the app

Asked

Viewed 82 times

2

I wonder how to lock the phone via the code to stay only in the application, when press back and home on the device do nothing, then pressing a button it leaves the application.

You can do it?

  • http://stackoverflow.com/questions/8430805/android-clicking-twice-the-back-button-to-exit-activity I think this may help.

1 answer

1


Prevent closing your application through the back button is easy, just overwrite the method onBackPressed of his Activity and not fire the super.

@Override
public void onBackPressed() {
    // super.onBackPressed(); <- Não utilizar!
}

Overwrite the button Home I think it’s almost impossible the way you want it, because I believe the only way is to make a Launcher, but when the button is pressed, Android asks the user which Auncher use and among them will have their.

If you want to try this way, here has a tutorial for this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.