如何强制解锁屏幕显示?

时间:2015-10-23 09:56:41

标签: android notifications

我试图实现"再次触摸打开"点击锁定屏幕上的通知时。但我似乎无法理解如何让屏幕解锁视图显示出来?是否有意图或某事要播出?

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试从KeyguardManager类中调用requestDismissKeyguard()方法:

KeyguardManager mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);

if (mKeyguardManager.isDeviceLocked()) {
  mKeyguardManager.requestDismissKeyguard(this, new KeyguardManager.KeyguardDismissCallback() {
    @Override
    public void onDismissSucceeded() {
      super.onDismissSucceeded();
      //TODO
    }
  });
}