锁定屏幕

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();
        }


更多详细的说明和代码看 http://developer.android.com/guide/topics/admin/device-admin.html

你可能感兴趣的:(Security)