Android中的设备密码是否存在
当我的应用程序启动时,我想知道屏幕锁定密码是否已经存在。
情况1:如果已经有屏幕锁定密码...我将使用设备管理器进行锁定(locknow())并要求用户再次登录。
情况 2:如果没有屏幕锁定密码....我会要求用户使用 devicepolicymanager 类设置密码。
但我不知道如何检查屏幕锁定密码是否已经存在。设备管理器 api 中是否有任何布尔返回方法?...我无法
知道是否存在活动管理员...现在,有人可以告诉我如何知道屏幕锁定密码是否存在是否已经存在...
这是不允许应用程序开发人员找到的安全事物吗?
有系统级方法吗?
设备策略管理器可以帮助我获取该信息吗?
提前致谢
I am trying to know whether a screen lock password is already present or not, when my app has started.
case 1: If there is a screen lock password already... I would do the locking (locknow()) using device manager and ask the user to login again.
case 2: If there is no screen lock password.... i would ask user to set a password using devicepolicymanager class.
But I was unable to know, how to check whether a screen lock password is already present or not. is there any boolean returning method in device manager api ?...i was unable any of such
I was able to know whether active admins are present or not.... now,can someone tell me how to know whether a screen lock password is already present or not ...
Is it a secuirty thing that app developers are not allowed to find?
Is there a system level approach?
can device policy manager help me to get that info?
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
API 级别 16 中引入了方法 isKeyguardSecure()
The method isKeyguardSecure() is introduced in API Level 16
请参阅此处如何显示屏幕已锁定?。这个问题在那里得到了广泛的讨论和解决
Look here How to reveal that screen is locked?. The matter was extensively discussed and resolved there
尝试以下操作:
结论:
使用 setPasswordMinimumLength(..., 1)
检查密码是否足够
如果没有使用resetPassword()设置密码
调用lockNow()
Try the following:
Conclusion:
use setPasswordMinimumLength(..., 1)
check if password is sufficient
if not set password with resetPassword()
call lockNow()
也许您已经找到了解决方案。不过,我将其发布在这里以供将来参考。
您可以使用 DevicePolicyManager 中的 isActivePasswordSufficient() 方法来检查密码的当前状态以及可用性。
请参阅 http://developer.android.com/更多详情请参考/android/app/admin/DevicePolicyManager.html#isActivePasswordSufficient%28%29。
May be you have already found the solution. However I'm posting here this for the future reference.
You can use isActivePasswordSufficient() method in DevicePolicyManager to check the current status of the password as well as the availability.
Refer http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#isActivePasswordSufficient%28%29 for more details.