我正在使用以下代码启动要求用户授予应用程序、设备管理员状态的活动。
mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
try {
mDeviceAdminSample = new ComponentName(this, WatchDogAdmin.class);
} catch (Exception ex) {
// TODO Auto-generated catch block
Toast.makeText(this, ex.getMessage(), Toast.LENGTH_LONG).show();
}
Intent intent2 = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
// Intent intent2 = new Intent(this, ShuntActivity.class);
intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent2.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mDeviceAdminSample);
intent2.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "Device admin rights are required for this application to work correctly.");
// startActivityForResult(intent, RESULT_ENABLE);
startActivity(intent2);
我究竟做错了什么 ?没有错误,活动根本没有启动。