0

I am having a really strange issue with GCM. I have logged to a text file every time my device has received a GCM message.

I send GCM messages to begin tests in my application but was receiving incorrect data in incorrect tests. I noticed that after a reboot the next push that get's sent is sending in upwards of 90 GCM messages to the device. I have doubled checked my server code to make sure that it is only sending a single push, but then after the reboot it sends every push for the last twelve hours or so again.

I am receiving the same push multiple times, I know this because the messages have a unique ID from our system that identifies each push.

Has anyone else noticed the same issue? Can anyone tell me how to prevent these multiple pushes from being sent at the same time? Including old pushes that have already been processed.

Thanks

EDIT: After more debugging I can confirm that the GCM Servers are blasting through the messages again after a reboot. I added a timestamp for when the GCM message was created into the message itself, added a time_to_live value of 360 (6 min) and added a collapse key. None of these features are preventing the GCM messages being sent again. I have received the same message created at 9:00:08 at both 9:00:09 and then again, after a reboot at 09:45:37. The timestamp was still set to 9:00:08. I really need some assistance, I am struggling to believe this is the intended behaviour of GCM.

SeanSWatkins
  • 413
  • 4
  • 9
  • You should use [Canonical IDs](https://developers.google.com/cloud-messaging/registration#canonical-ids) for this. This might happen because you registered with several IDs for the same device. Using canonical IDs will set your ID to be the last registration you've made. You can see this [sample code](http://stackoverflow.com/questions/15832171/gcm-canonical-id/29818357#29818357). – LexJulienne Feb 21 '16 at 12:57
  • Would this account for close on a hundred pushes coming through? I am also getting old pushes sent through that have already been processed, I am not sure this would account for the issue I am seeing. – SeanSWatkins Feb 22 '16 at 13:22
  • Just an update, Canonical ID's didn't help. Still get a couple hundred Pushes coming through. Decided to just create a push buffer that prevents pushes from swamping the device – SeanSWatkins Apr 26 '16 at 07:35

0 Answers0