我正在使用此链接测试我的推送通知。昨晚它工作得很好,但早上醒来后,我不再收到推送通知。在编写任何新代码之前,我进行了测试。用于测试的设备是三星Galaxy S5,操作系统为棒棒糖。
这是我的清单,如果需要查看我的任何服务,请告诉我。
<permission
android:name=".permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name=".permission.C2D_MESSAGE" />
<application
....
....
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.fullpackage.name.gcm" />
</intent-filter>
</receiver>
<service
android:name=".services.MyGcmListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name=".services.MyInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
我没有收到任何错误提示,从我的服务器和测试链接上都显示消息发送成功。我已经尝试卸载应用程序并生成新的令牌,但仍然无法工作。每次加载应用程序时,我也能够成功检索到我的令牌。
.permission.C2D_MESSAGE
和完整描述的my.package.name.permission.C2D_MESSAGE
。教程已经仔细阅读。 - i_me_mine