Vote count:
0
I used the below code to put password screen lock...but when the activity is called my app gets crash.. Do i need to add any permissions in android manifest?? How do i go about this..
public class LockDevice extends Activity{
public static DevicePolicyManager devicePolicyManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
System.out.println("hello");
DevicePolicyManager devicePolicyManager =(DevicePolicyManager)getApplicationContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName demoDeviceAdmin =new ComponentName(this, LockDevice.class);
devicePolicyManager.setPasswordQuality(demoDeviceAdmin,DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
devicePolicyManager.setPasswordMinimumLength(demoDeviceAdmin, 5);
boolean result = devicePolicyManager.resetPassword("123456", DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);
Toast.makeText(this, "button_lock_password_device..."+result, Toast.LENGTH_LONG).show();
}
}
asked 35 secs ago
how to put password screen lock to android phone programatically using my app
Aucun commentaire:
Enregistrer un commentaire