2012-08-06 19 views
1

正如我們所知,Android ICS提供人臉解鎖選項來鎖定設置 - >安全 - >屏幕鎖定中的屏幕。Android DevicePolicyManager啓用人臉解鎖

有沒有一種方法可以使用DevicePolicyManager以編程方式啓用Face Locking,就像啓用MDM的密碼限制一樣?

我已經瀏覽了API Level 16中的DevicePolicyManager類,但找不到它。 有沒有其他辦法可以實現這一目標?

謝謝。

回答

2

Face Unlock由PASSWORD_QUALITY_BIOMETRIC_WEAK標誌控制,並與setPasswordQuality一起使用。

例如,下面的代碼將要求用戶擁有人臉解鎖密碼(或更好)集,並在需要時將提示他們更新密碼:

DevicePolicyManager mDPM = (DevicePolicyManager) 
     context.getSystemService(Context.DEVICE_POLICY_SERVICE); 
ComponentName mPolicyAdmin = new ComponentName(context, PolicyAdmin.class); 

// Enforce Face Unlock or better for new passwords 
mDPM.setPasswordQuality(mPolicyAdmin, 
         DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK); 

// Prompt user to upgrade password if necessary 
if (!mDPM.isActivePasswordSufficient()) { 
    Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD); 
    startActivity(intent); 
} 
+0

它的工作原理,謝謝。 – Naga 2012-09-28 14:31:21