简体   繁体   English

从android终端禁用设备所有者应用

[英]Disable a device owner app from android terminal

well, my problem is: I have an application which is set as the device owner of a device (my tablet in this case). 好吧,我的问题是:我有一个设置为设备(在本例中为平板电脑)的设备所有者的应用程序。 I did it from the terminal in Ubuntu, connecting the tablet to my PC and executting this line in the adb shell: 我是在Ubuntu的终端上完成此操作的,将平板电脑连接到PC并在adb shell中执行了这一行:

dpm set-device-owner my.app.package/my.app.route.MyAdmin

So, I want to disable the device owner app without restoring the device, just executing a line similar to the last one. 因此,我想禁用设备所有者应用程序而不恢复设备,而只是执行与上一个类似的一行。 Me and my coworker have been researching for a long time and we've never found anything about this, so I would like to know if it is possible or not, and if it is, how to do that. 我和我的同事已经进行了很长时间的研究,而我们对此一无所获,所以我想知道是否有可能,以及如何做到这一点。

Thanks! 谢谢!

you can use the following ADB shell command to remove device owner 您可以使用以下ADB Shell命令删除设备所有者

adb shell dpm remove-active-admin com.example.app/.AdminReceiver

Disables an active admin, the admin must have declared android:testOnly in the application in its manifest. 禁用活动管理员,该管理员必须在清单中的应用程序中声明了android:testOnly This will also remove device owner and profile owners 这也将删除设备所有者和配置文件所有者

You can use DevicePolicyManager.clearDeviceOwnerApp() from your device owner app. 您可以从设备所有者应用程序使用DevicePolicyManager.clearDeviceOwnerApp()

However note that this method has been deprecated in Android Oreo, you can still use it on Oreo devices but it might be removed in future Android versions. 但是请注意,此方法已在Android Oreo中弃用,您仍然可以在Oreo设备上使用它,但是在以后的Android版本中可能会删除该方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM