【发布时间】:2014-11-13 22:18:28
【问题描述】:
我正在尝试使用 adb 和命令行来模拟设备正在接收 GCM 推送消息。我试过这个命令来广播 GCM 意图:
adb shell am broadcast -c com.myapp -a com.google.android.c2dm.intent.RECEIVE -e data "SomeData"
这会触发“权限拒绝”日志行:
09-19 12:23:34.820 725-787/? W/BroadcastQueue﹕ Permission Denial: broadcasting Intent { act=com.google.android.c2dm.intent.RECEIVE cat=[com.myapp] flg=0x10 (has extras) } from null (pid=21244, uid=2000) requires com.google.android.c2dm.permission.SEND due to receiver com.myapp/com.google.android.gcm.GCMBroadcastReceiver
我的清单的相关部分:
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.myapp" />
</intent-filter>
</receiver>
</application>
有什么想法吗?
编辑/澄清:推送/GCM接收生产中的作品。我正在寻找一种更简单的方法来测试更改。
【问题讨论】:
-
如何添加多个键值或一个意图
标签: android