[英]Device owner on Android TV Box not working
I want to install my application as device owner on Android TV Box and I get the next exception.我想在 Android TV Box 上以设备所有者的身份安装我的应用程序,但出现下一个异常。
adb shell dpm set-device-owner
"com.android.testapp/.receivers.AdminReceiver"
java.lang.RuntimeException: Can't set package com.android.testapp as
device owner.
at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:115)
at com.android.commands.dpm.Dpm.onRun(Dpm.java:82)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.dpm.Dpm.main(Dpm.java:38)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)
There are no accounts on the device.设备上没有帐户。 It works on my phones but not on the Android TV Box.
它适用于我的手机,但不适用于 Android 电视盒。
遗憾的是,无法在 Android TV 中将应用设置为设备所有者。
Format your Android TV Box.格式化您的 Android 电视盒。 Enable your developer option in Android TV Box Connect your Terminal with the IP address with command adb connect 192.168.X.XX
在 Android TV Box 中启用您的开发者选项 使用命令 adb connect 192.168.X.XX 将您的终端与 IP 地址连接起来
Install the apk Run below command to adb shell dpm set-device-owner /.DevAdminReceiver安装 apk 运行下面的命令到 adb shell dpm set-device-owner /.DevAdminReceiver
Steps to set-device-owner
through cmd,通过cmd
set-device-owner
步骤,
cd
command to ...Sdk\\platform-tools
cd
命令将目录设置为...Sdk\\platform-tools
adb shell
and hit enteradb shell
并按 Entershell@degas3g:/ $
in cmdshell@degas3g:/ $
dpm set-device-owner com.android.testapp/.receivers.AdminReceiver
and hit enterdpm set-device-owner com.android.testapp/.receivers.AdminReceiver
并按回车 For more information Click Here有关更多信息,请单击此处
EDITED已编辑
Receiver must be like this.接收器必须是这样的。
<receiver
android:name=".receiver.Receiver"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/device_admin" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.