Hanging the phone in the app only

2

I would like to know how to lock the cell phone via code to stay in the application only, when pressing back and home on the device do nothing, then pressing a button it quits the application.

Can you do this?

    
asked by anonymous 10.02.2015 / 00:46

1 answer

1

Prevent closing your app with the back button is easy, just overwrite the onBackPressed method of your main Activity and do not fire the super .

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

Overwrite the Home button I think it's almost impossible the way you want, as I believe the only way is to do a Launcher , but when the button is pressed, Android asks the user which launcher to use and it will have theirs.

If you want to try this form, here > have a tutorial for this.

    
10.02.2015 / 12:41