即使响应成功,也没有收到GCM的推送通知


Not getting push notification from GCM eventhough response is success

我想通过使用GCM推送通知,所有事情都做得很好,像API键&别人。

我正在获得以下成功消息,但没有在移动设备上获得通知(设备id也正确,也在不同的设备上尝试过)

 {"multicast_id":6811225836747189127,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1395652805845432%ae8ef3eff9fd7ecd"}]}

我可以知道实现我的目标的正确方法是什么吗?提前感谢

舱单码' '

<permission android:name="com.demo.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.demo.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />  <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <!-- Receives the actual messages. -->
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <!-- Receives the registration id. -->
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.demo" />
        </intent-filter>
    </receiver>
    <service android:name="com.demo.GCMIntentService" />                    ``

我也遇到过同样的问题。你应该检查你的"发送id"在你的代码中应该是这样的:

字符串SENDER_ID ="1090629393827";

这个数字是你的项目id。

…也试着允许任何IP在你的谷歌项目页面,并检查你的API密钥。由于某种原因,通过浏览器发送数据,我必须使用 browser API KEY而不是SERVER API KEY

最后,如果您使用的是模拟器,请检查您的防火墙设置!

对不起,我的英语不是我的母语。