I am making a proprietary app for a company which will never release it to the Android Market (or Play Store I guess now) in Ice Cream Sandwich (Android 4.0).
I need to disable the Home so the users cannot maliciously uninstall software or delete the data that the app captures. This latest version is the first to be written in 4.0, the previous versions were written in 2.2 and 3.2.
For disabling the Home button in 2.2, I associated the app as a home replacement, so the button just reopened the app, but I can no longer use this method, as that somewhat prevents us from doing our updates to the app (we don't want to give the user the option of reselecting a Home default, as that would lead to data deletion.
The code I have for disableing the Home button in 3.2 is:
@Override
public void onAttachedToWindow() {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
and, under onCreate:
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
But when I run the same code that worked on my 3.2 tablet, it does not work on my 4.0 tablet.
I was wondering if there is a new API or method that 4.0 has that will accomplish the same effect as I currently have in my 3.2 implementation.
Thanks for any help or direction.
Adam