如何检查设备已经设置密码或没有在android系统? [英] How to check the device has set password or not in android?

查看:255
本文介绍了如何检查设备已经设置密码或没有在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的申请,我要检查用户是否在他们的Andr​​oid设备设置密码或没有?我尝试使用设备管理员API的米不是能够得到这些信息。有没有其他办法?

In my application, I want to check whether the user has set the password in their android device or not? I tried using device admin apis m not able to get those information. Is there any other way?

推荐答案

设备管理员不允许您检查设备是否有锁屏密码(或模式...)的直接

Device administrator doesn't allow you to check whether device has lock screen password (or pattern ...) directly.

然而您可以做的间接


  1. 从设备管理密码质量水平(原值)

  2. 设置密码质量,设备管理员最低水平(即PASSWORD_QUALITY_SOMETHING)

  3. 设备管理员是否密码质量足够了(如果是真的=用户密码)

  4. 恢复原始密码质量级别(从步长值1)

  1. Retrieve password quality level from device admin (original value)
  2. Set password quality to device admin to minimum level (i.e. PASSWORD_QUALITY_SOMETHING)
  3. Ask device admin whether is password quality sufficient (if true = user has password)
  4. Restore original password quality level (value from step 1)

DevicePolicyManager 允许您<一个href=\"http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#setPasswordQuality%28android.content.ComponentName,%20int%29\"相对=nofollow>设置 / <一个href=\"http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#getPasswordQuality%28android.content.ComponentName%29\"相对=nofollow>获取所需的密码质量水平,<一个href=\"http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#isActivePasswordSufficient%28%29\"相对=nofollow>检查是否足以密码

DevicePolicyManager allows you to set/get required password quality level and check whether is password sufficient.

您的设备管理员将需要使用极限pasword政策:

Your device admin will need to use limit-pasword policy:

<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-policies>
    <limit-password />
  </uses-policies>
</device-admin>

你应该definetely阅读此设备管理员指南

这篇关于如何检查设备已经设置密码或没有在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆