I am using DevicePolicyManager to setup password policies , i have used the below and they are working fine
DevicePolicyManager devicePolicyManager;
ComponentName demoDeviceAdmin;
// Initialize Device Policy Manager service and our receiver class
devicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
demoDeviceAdmin = new ComponentName(this, AdminReceiver.class);
devicePolicyManager.lockNow();
devicePolicyManager.wipeData(0);
but when i used the below methods of DevicePolicyManager to create a password validations like below they are not working
devicePolicyManager.setPasswordMinimumLetters(demoDeviceAdmin, 2);
devicePolicyManager.setPasswordMinimumLowerCase(demoDeviceAdmin, 2);
devicePolicyManager.setPasswordMinimumNumeric(demoDeviceAdmin, 2);
devicePolicyManager.setPasswordMinimumUpperCase(demoDeviceAdmin, 2);
devicePolicyManager.setPasswordMinimumLength(demoDeviceAdmin, 10);
only the below method is working
devicePolicyManager.setPasswordMinimumLength(demoDeviceAdmin, 10);
please anyone guide me what i am doing wrong ?
public class AdminReceiver extends DeviceAdminReceiver {
@Override
public void onEnabled(Context context, Intent intent) {
super.onEnabled(context, intent);
showToast(context, "---onEnabled----");
Log.e("------onEnabled--------", "------onEnabled--------");
}
@Override
public CharSequence onDisableRequested(Context context, Intent intent) {
// TODO Auto-generated method stub
showToast(context, "---onDisableRequested----");
Log.e("------onDisableRequested--------", "------onDisableRequested--------");
return super.onDisableRequested(context, intent);
}
@Override
public void onPasswordExpiring(Context context, Intent intent) {
// TODO Auto-generated method stub
super.onPasswordExpiring(context, intent);
showToast(context, "----onPasswordExpiring---");
}
@Override
public void onPasswordFailed(Context context, Intent intent) {
// TODO Auto-generated method stub
super.onPasswordFailed(context, intent);
showToast(context, "----onPasswordFailed---");
}
@Override
public void onPasswordSucceeded(Context context, Intent intent) {
// TODO Auto-generated method stub
super.onPasswordSucceeded(context, intent);
showToast(context, "----onPasswordSucceeded---");
}
void showToast(Context context, String msg) {
Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
}
@Override
public void onDisabled(Context context, Intent intent) {
showToast(context, "onDisabled");
Log.e("------onDisabled--------", "------onDisabled--------");
}
@Override
public void onPasswordChanged(Context context, Intent intent) {
showToast(context, "----onPasswordChanged---");
}
}