Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GCM one device has multiple registrationid

I have system that has PHP Server side and Android Client side application. Android sends parameters via webservice and PHP handle the GCM side. PHP sends push notification and before sent, it gets all registrationid from DB. The problem is, same device may have two or more registrationid. Because of this, push notification sent to same devices for two or more times. Is there any solution to handle this problem?

like image 262
iravul Avatar asked May 29 '13 07:05

iravul


1 Answers

GCM can change the registrationId and you have to update it on your server-side.

  • When you send a message the result can contain the new registrationId that is going to be used for the device, so you have to update the old registrationId for the new one.

Look this link at Interpreting a success response section

If message_id is set, check for registration_id: If registration_id is set, replace the original ID with the new value (canonical ID) in your server database. Note that the original ID is not part of the result, so you need to obtain it from the list of registration_ids passed in the request (using the same index).

like image 183
AlexBcn Avatar answered Sep 27 '22 17:09

AlexBcn