Android GCM send push notification multiple times

405 views Asked by At

I have a released application which is working fine. But now I would like to release a new version and I tested push notification before I upload it to the play store. In the app I register to GCM and the pushnotification id will be send to our backend. When the user do something in the app or website the backend send a notification to the GCM and the GCM should send the notificaton to users device. BUT, the device got multiple times this notification. I logged my GcmListenerService and I see that the onMessageReceived() method called after 2 minutes, and after 4 minutes and after 8 minutes and after 16 minutes, and after 32 minutes. So my application got the same notification multiple times. Why?

2

There are 2 answers

1
Mark Sheekey On

Without further info I would suspect your server is resending the messages rather than the app receiving them multiple times.

1
abielita On

As stated here, there are instances wherein the GCM engine might change the registration ID whenever it determines it need to. And this might happen at anytime without prior warning. That's why you should always check if the last registration ID matches the one that is current. You may also refer with this link. Maybe your regid registered more times in your database.