【发布时间】:2015-05-12 06:14:19
【问题描述】:
我使用this question 来测试我自己的应用程序的重启广播。 即,
C:\Eclipse\sdk\platform-tools>adb shell am broadcast -a
android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME
-n my.own.app/.BRAutoStart Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED
cat=[android.intent.category.HOME] cmp=my.own.app/.BRAutoStart }
Broadcast completed: result=0
但它不起作用。
简单的命令重启设备:
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c
android.intent.category.HOME
我知道广播接收器 BRAutoStart 接收到 boot_completed ,因为我已经对其进行了测试并在生产代码中使用它。
我用的是真机,不是模拟器。
如何设置命令行向设备发送广播?
【问题讨论】:
-
这可能是因为只有系统可以发送这个特定的动作:developer.android.com/reference/android/content/Intent.html
-
“这是一个受保护的意图,只能由系统发送。”。
-
@YogeshRathi 大声笑这个问题很早就创建了
-
@Vyacheslav,我同意
标签: android android-intent adb