There are some types of application where you need to programatically disable the keyguard. It’s also sometimes useful to temporarily do this when you are presenting a demo. com.android.alarmclock.AlarmAlert in the Android OS source code provides and example how to do this…
private synchronized void enableKeyguard() {
if (mKeyguardLock != null) {
mKeyguardLock.reenableKeyguard();
mKeyguardLock = null;
}
}
private synchronized void disableKeyguard() {
if (mKeyguardLock == null) {
mKeyguardLock = mKeyguardManager.newKeyguardLock(Log.LOGTAG);
mKeyguardLock.disableKeyguard();
}
}
where
mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
I have also come across a great class, ManageKeyguard in the source of SMSPopup. This provides an example how to disable the keyguard, show your activity and re-enable the keyguard without letting someone get past the keylock to other activities. There’s also more about this discussed on the Google groups.
One Response to “How to Disable the Keyguard”
…
Интересно …
Leave a Reply:
You must be logged in to post a comment.