Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!mDPM.isAdminActive(mDeviceAdminSample)) {
- // try to become active – must happen here in this activity, to get result
- Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
- intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,mDeviceAdminSample);
- intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,"Admin is added to do security operation.");
- startActivityForResult(intent, 0);
- } else {
- // Already is a device administrator, can do security operations now.
- mDPM.lockNow();
- }
- KeyguardManager manager = (KeyguardManager)context.getSystemService(KEYGUARD_SERVICE);
- kl = manager.newKeyguardLock("my-remote-app");
- kl.disableKeyguard();
- onDestroy() {
- kl.reenableKeyguard();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement