I'm creating an Android app for toddlers. So, I need to lock as many buttons as possible to prevent the toddler from accessing other features of the Android device. Basically, I'm looking to reproduce the locking mechanism in popular toddler apps like "Toddler Lock". I have logic that requires the user to tap the four corners of the screen in a clockwise motion to exit the app.
To show the app in full-screen I have the following in my manifest
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
To show the app in landscape mode only, I have the following in my activity's onCreate event
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
To prevent any of the buttons from being used, I override the onKeyDown event with the following code
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return true;
}
It all works great. So far, so good. There is only one button I can't seem to disable... the power button. I'm operating under the assumption that there is no way to disable the power button. Please let me know if I'm wrong. So, I need to figure out how to deal with that. Obviously, if the power button is held in and the device is powered down then there is nothing I can do about that. However, if the power button is tapped to turn the screen off and then tapped again to turn the screen back on, I would like to be able to deal with that appropriately.
What's happening is that the app resumes running, but it is no longer in full screen. The notification bar is displayed. As such, I can pull it down and access other areas of Android.
Why is it that waking the screen on the Android device causes the notification bar to appear over a full-screen app configured as described above... and how do I prevent it?