简体   繁体   English

通知到达Android应用后无法解锁屏幕图案/锁定密码

[英]Unable to unlock screen pattern/pin lock on notification arrival in Android app

I am making an Android hybrid application in which my requirements are that as soon as a notification arrives, my app should open and disable all locks. 我正在制作一个Android混合应用程序,其中的要求是,一旦收到通知,我的应用程序应打开并禁用所有锁。 I tried using KeyguardManager(deprecated) but it's working on some devices only. 我尝试使用KeyguardManager(deprecated)但仅在某些设备上有效。 Basically below Lollipop only. 基本上只低于棒棒糖。

Now I am using this piece of code to achieve the desired result but all in vain. 现在,我正在使用这段代码来实现所需的结果,但徒劳无功。 I have seen many posts regarding the same issue everywhere. 我到处都看到过很多关于同一问题的帖子。 FLAG_DISMISS_KEYGUARD is suggested as a replacement for KeyguardManager , but this is not working for me. FLAG_DISMISS_KEYGUARD被建议作为替代KeyguardManager ,但是这不是为我工作。

((Activity) mContext).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | 
    WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | 
    WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | 
    WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON,
    WindowManager.LayoutParams.FLAG_FULLSCREEN | 
    WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | 
    WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | 
    WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);

Flag dismisse full screen, flag show when local, flag dismisse anoymous input method 标志关闭全屏显示,本地显示标志,标志关闭输入法

Irish of. 爱尔兰的。

Is

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM