I am making an app where privacy is of utmost importance. So, there is a password to enter the app. Now, the problem lies when the user presses the HOME button - then, what happens is that the current task is taken to the background and the android home screen is displayed.
But when the user clicks on the app's icon on the android device, the app returns to the same private state without asking for the password.
I want to make the app always start at the Login Activity only when the app's icon is pressed.
In each and every one of my activities, I have the following code:
if ((keyCode == KeyEvent.KEYCODE_HOME)) {
Toast.makeText(this, "You pressed the home button!", Toast.LENGTH_LONG).show();
return true;
}
return super.onKeyDown(keyCode, event);
But, the toast is never getting displayed...similarly, I tried to
finish();
the process in the code. But it doesn't happen. Is it not possible to control what the home button does, or am i missing something out?
Thanks!