是否有可能以编程方式停用(第三方)设备管理员应用?
我可以检索所有与设备管理器中的应用程序使用 DevicePolicyManager 和 getActiveAdmins():
最后DevicePolicyManager DPM =(DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);最终名单<&组件名GT; adminList = dpm.getActiveAdmins();对于(组件名的应用:adminList){ Log.d(TAG,应用,app.getPackageName());}
然而,为了解除他们,我不能使用 removeActiveAdmin(...)的,因为它不会删除组件,是不是我自己的应用程序。
我想使用一个的意图和 startActivity()为了打开特定组件我要停用的设备管理员停用页面。这可能吗?
解决方案是否有可能以编程方式停用(第三方),设备管理应用程序?
没有。这是不可能通过编程激活一个,无论
我想用一个Intent和startActivity(),以打开特定的组件我要停用的设备管理员停用页面。
有在设置应用程序没有入口点直接去删除-A-设备管理界面,更不用说它记录意图
的行动。您可以添加设备管理员通过这种方式,而不是将其删除。
Is it possible to programmatically deactivate a (third-party) Device Administrator app?
I was able to retrieve all the apps with Device Administrator activated using the DevicePolicyManager and getActiveAdmins():
final DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
final List<ComponentName> adminList = dpm.getActiveAdmins();
for ( ComponentName app : adminList ) {
Log.d(TAG, "App: ", app.getPackageName());
}
However, in order to deactivate them, I cannot use removeActiveAdmin(...), since it won't remove a component that is not my own app.
I was thinking to use an Intent and startActivity() in order to open the Device Administrator's deactivation page of that specific component I want to deactivate. Is it possible?
解决方案Is it possible to programmatically deactivate a (third-party) Device Administrator app?
No. It is not possible to programmatically activate one, either.
I was thinking to use an Intent and startActivity() in order to open the Device Administrator's deactivation page of that specific component I want to deactivate.
There is no entry point in the Settings app to directly go to the remove-a-device-admin screen, let alone a documented Intent
action for it. You can add device administrators this way, but not remove them.