【发布时间】:2014-12-28 11:57:50
【问题描述】:
这个问题到现在还没有答案??? 在我的应用程序中,我使用下面的代码禁用了键盘锁(即删除锁屏),它工作正常,直到我点击通知栏中的任何通知。如果我单击通知,锁定屏幕会自动重新启用。任何帮助表示赞赏。
private void remove_lockscreen() {
final CheckBoxPreference lock = (CheckBoxPreference) findPreference("remove_lockscreen");
KeyguardManager km = (KeyguardManager)getSystemService(KEYGUARD_SERVICE);
KeyguardLock kl = km.newKeyguardLock("keyguard_lock");
if (lock.isChecked()) {
prefEdit("remove_lockscreen", 1);
Toast.makeText(getBaseContext(), "Lockscreen will not be shown", Toast.LENGTH_SHORT).show();
kl.disableKeyguard();
}
else if (!lock.isChecked()) {
prefEdit("remove_lockscreen", 0);
Toast.makeText(getBaseContext(), "Lockscreen will be shown", Toast.LENGTH_SHORT).show();
kl.reenableKeyguard();
android.os.Process.killProcess(android.os.Process.myPid());
}
}
我使用了这段代码 Disabled Keyguard Lock re-enables itself after clicking on a notification 但从不工作!!??? 任何帮助
【问题讨论】:
-
您使用的是哪个 API 级别?
-
此代码适用于某些设备,而其他不适用 [注 4]
-
android:minSdkVersion="11" android:targetSdkVersion="21" />
-
prb 在点击任何通知时通过所有移动设备重新启用它