任何人都知道,如何在react native中以程序方式将用户引导到设备管理应用程序页面?
因此,在没有用户的情况下,所有进入应用程序都必须转到"设置"中的手动菜单>隐私>管理>特殊应用程序访问>设备管理应用程序。。
提前感谢
设备管理应用程序图像权限应用程序清单Image
我不知道在React中,但假设您可以使用"纯";代码:
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, AdminManager.mDeviceAdminSample);
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "Admin rights");
startActivityForResult(intent, REQUEST_ADMIN_PERMISSION);
是你需要的线路。当然,您需要所需的对象。所有信息都可以找到:https://developer.android.com/guide/topics/admin/device-admin
// Initiate DevicePolicyManager.
mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
// Set DeviceAdminDemo Receiver for active the component with different option
mAdminName = new ComponentName(this, MyAdminLocal.class);
if (!mDPM.isAdminActive(mAdminName)) {
// try to become active
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mAdminName);
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "Click on Activate button to secure your application.");
startActivityForResult(intent, REQUEST_CODE);
}
else
{
// Already is a device administrator, can do security operations now.
mDPM.lockNow();
}
只需将此代码复制到MainActivity.java中的onStart((函数中