Code example for DevicePolicyManager

Methods: setPasswordMinimumLengthsetPasswordMinimumUpperCasesetPasswordQuality

0
 
    /** 
     * Configure policy defined in the object. 
     */ 
    public void configurePolicy() { 
        mDPM.setPasswordQuality(mPolicyAdmin, PASSWORD_QUALITY_VALUES[mPasswordQuality]);
        mDPM.setPasswordMinimumLength(mPolicyAdmin, mPasswordLength);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            mDPM.setPasswordMinimumUpperCase(mPolicyAdmin, mPasswordMinUpperCase);
        } 
    } 
 
    /** 
     * Through the PolicyAdmin receiver, the app can use this to trap various device 
     * administration events, such as password change, incorrect password entry, etc. 
     * 
     */ 
    public static class PolicyAdmin extends DeviceAdminReceiver {
 
        @Override