I've Got This Response From The GCM Server {“success”:1} But the Notification not Come to the Device

前端 未结 1 1505
感情败类
感情败类 2020-12-17 03:29

I am trying to Notify the Device by the Push Notification

I Received this Response From THE GCM Server

{\"multicast_id\":8594338261894783

相关标签:
1条回答
  • 2020-12-17 03:40

    Take a look at the Response format in the GCM documentation: http://developer.android.com/google/gcm/gcm.html#response

    success     Number of messages that were processed without an error.
    

    What I understand that to mean is that GCM was able to process that message, it does not mean that the message was successfully sent to the device. (E.g. The device might be offline and will receive it later, but the message was successfully processed).

    "canonical_ids":0 Does not mean that there was an error, it means that there were no devices that needed their ID's updated. You can read more about canonical ID's here: http://developer.android.com/google/gcm/adv.html#canonical

    On the server side, as long as the application is behaving well, everything should work normally. However, if a bug in the application triggers multiple registrations for the same device, it can be hard to reconcile state and you might end up with duplicate messages.

    GCM provides a facility called "canonical registration IDs" to easily recover from these situations. A canonical registration ID is defined to be the ID of the last registration requested by your application. This is the ID that the server should use when sending messages to the device.

    If later on you try to send a message using a different registration ID, GCM will process the request as usual, but it will include the canonical registration ID in the registration_id field of the response. Make sure to replace the registration ID stored in your server with this canonical ID, as eventually the ID you're using will stop working.

    I would suggest adding some logging code to your client, to make sure that you are not receiving the message. Specifically in your GCMIntentService classes onMessage() method.

    0 讨论(0)
提交回复
热议问题