简体   繁体   English

无法从adb shell发送android.intent.action.BOOT_COMPLETED

[英]Unable to send android.intent.action.BOOT_COMPLETED from adb shell

I am building an app, which needs to start a service automatically when the device boots up. 我正在构建一个应用,该应用需要在设备启动时自动启动服务。

I want to test this functionality with adb. 我想使用adb测试此功能。 When I issue the following command from adb 当我从adb发出以下命令时

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED

I get the following error. 我收到以下错误。

Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED }
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=3566, uid=2000
        at android.os.Parcel.readException(Parcel.java:1683)
        at android.os.Parcel.readException(Parcel.java:1636)
        at android.app.ActivityManagerProxy.broadcastIntent(ActivityManagerNative.java:3507)
        at com.android.commands.am.Am.sendBroadcast(Am.java:772)
        at com.android.commands.am.Am.onRun(Am.java:404)
        at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
        at com.android.commands.am.Am.main(Am.java:121)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)

According to this answer stackoverflow.com/a/10105047/106248 others didn't face this problem. 根据这个答案stackoverflow.com/a/10105047/106248,其他人没有遇到这个问题。

The OS version I am testing on is Android 7.0. 我正在测试的操作系统版本是Android 7.0。 I am facing the same problem on both real device and emulator. 我在真实设备和仿真器上都面临相同的问题。

Please help me solve the problem. 请帮我解决问题。

Thank you 谢谢

在root模式下重新启动ADB为我解决了这个问题:

adb root

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

相关问题 通过ADB启动android.intent.action.BOOT_COMPLETED - Launch android.intent.action.BOOT_COMPLETED through ADB Jellybean上的android.intent.action.BOOT_COMPLETED - android.intent.action.BOOT_COMPLETED on Jellybean 调试android.intent.action.BOOT_COMPLETED - Debug android.intent.action.BOOT_COMPLETED android.intent.action.BOOT_COMPLETED“重启”或“重启”未收到意图 - android.intent.action.BOOT_COMPLETED Intent is not received at “Restart” or “Reboot” android.intent.action.BOOT_COMPLETED不适用于nexus 4 - android.intent.action.BOOT_COMPLETED not working with nexus 4 Android:ICS和Gingerbread上的android.intent.action.BOOT_COMPLETED - Android : android.intent.action.BOOT_COMPLETED on ICS and Gingerbread 在android.intent.action.BOOT_COMPLETED上获取网络 - Get Network on android.intent.action.BOOT_COMPLETED android.intent.action.BOOT_COMPLETED-如果通过电话启动完成,则不会接收广播 - android.intent.action.BOOT_COMPLETED - do not receive broadcast if boot completed by a phone call W / BroadcastQueue:拒绝Appapp:广播Intent {act = android.intent.action.BOOT_COMPLETED - W/BroadcastQueue: Appop Denial: broadcasting Intent { act=android.intent.action.BOOT_COMPLETED android.intent.action.BOOT_COMPLETED不会在启动时被解雇 - android.intent.action.BOOT_COMPLETED doesn't get fired on boot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM