编程停用的Andr​​oid将设备Admininstrator? [英] Programmatically deactivate a Device Admininstrator in Android?

查看:336
本文介绍了编程停用的Andr​​oid将设备Admininstrator?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能以编程方式停用(第三方)设备管理员应用?

我可以检索所有与设备管理器中的应用程序使用 DevicePolicyManager 和<一个href=\"http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#getActiveAdmins%28%29\"相对=nofollow> getActiveAdmins():

 最后DevicePolicyManager DPM =(DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
最终名单&LT;&组件名GT; adminList = dpm.getActiveAdmins();对于(组件名的应用:adminList){
    Log.d(TAG,应用,app.getPackageName());
}

然而,为了解除他们,我不能使用<一个href=\"http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#removeActiveAdmin%28android.content.ComponentName%29\"相对=nofollow> removeActiveAdmin(...)的,因为它不会删除组件,是不是我自己的应用程序。

我想使用一个的意图和<一个href=\"http://developer.android.com/reference/android/content/Context.html#startActivity%28android.content.Intent%29\"相对=nofollow> 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.

这篇关于编程停用的Andr​​oid将设备Admininstrator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆