简体   繁体   English

使用 adb 激活 set-device-owner 时出错

[英]error in activing set-device-owner using adb

i want to set device owner and active on my application using adb and dpm .我想使用 adb 和 dpm 在我的应用程序上设置设备所有者和活动。 i want to use startlocktask().我想使用startlocktask(). for creating kiosk application.用于创建信息亭应用程序。 but when i run this line in my commandline:但是当我在命令行中运行这一行时:

./adb shell dpm set-device-owner com.pakban.mobile.pinningtest/.AdminReceiver 

i recived an error like this :我收到这样的错误:

Error: Bad admin: ComponentInfo{com.pakban.mobile.pinningtest/com.pakban.mobile.pinningtest.AdminReceiver}

thanks for your answers谢谢你的回答

in my case, i used tutorial on net like this link就我而言,我在网上使用教程,如此链接

http://florent-dupont.blogspot.fr/2015/01/android-shell-command-dpm-device-policy.html http://florent-dupont.blogspot.fr/2015/01/android-shell-command-dpm-device-policy.html

at this time, non of example and tutorial not mentioned how to create device_admin xml file(or i couldn't find it).此时,示例和教程中没有提到如何创建 device_admin xml 文件(或者我找不到它)。 so you need create a folder under res with "xml" name.所以你需要在 res 下创建一个名为“xml”的文件夹。 and then, you must create a xml file with "device_admin" name.然后,您必须创建一个名为“device_admin”的 xml 文件。 in this xml file just add this tag:在这个 xml 文件中添加这个标签:

<device-admin>
</device-admin> 

只需检查您的“AndroidManifest.xml”一次并确保您已正确提及接收者的属性值。

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

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