简体   繁体   English

在Android上检测解锁屏幕类型

[英]Detect unlock screen type on Android

Is there a way to detect how actually user unlock phone? 有没有办法检测用户实际如何解锁手机? - via PIN or pattern or using swipe gesture I've googled only smth about registering Receiver with this code in onReceive() -通过PIN或图案或使用滑动手势,我只搜索了有关在onReceive()使用此代码注册Receiver一些信息

KeyguardManager keyguardManager = 
            (KeyguardManager)context.getSystemService(Context.KEYGUARD_SERVICE);
        if (keyguardManager.isKeyguardSecure())

Since the Settings.Secure.getLong method is deprecated since API level 23, and that it has been replaced by the KeyGuardManager , it doesn't seem possible to retrieve the exact lock type. 由于自API级别23起不推荐使用Settings.Secure.getLong方法,并且该方法已被KeyGuardManager取代,因此似乎无法检索确切的锁类型。

As you've found out, using isDeviceSecure() is the closest information you can retrieve. 如您所知 ,使用isDeviceSecure()是您可以检索的最接近的信息。

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

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