Registration ID question on Google Cloud Message

2

I want to implement GCM in my project, but I have some questions and I needed to get them all out before doing it.

Well when I register a device on the GCM server, is the id it receives unique? If I uninstall the application and install again, can I guarantee that that device is already registered, ie does it use the id that was created only once?

I wanted the user to register on a device, but when he logged on to another device having the same GCM id, so that two devices would get the message together, but is that not possible?

    
asked by anonymous 08.07.2014 / 19:13

1 answer

2
  

Well when I register a device on the GCM server, is the id it receives unique? If I uninstall the application and install again, can I guarantee that that device is already registered, ie does it use the id that was created only once?

Answer:

Yes, it is guaranteed even with the uninstallation, since the registration ID would be the device's IMEI .

  

I wanted the user to register on a device, but when he logged on to another device having the same GCM id, so that two devices would get the message together, but is that not possible?

Response

Create a user data persistence structure, where you store registration_id at the time of login to be able to send push notifications to users.

Example:

registration_id table

gcm_id | id_usuario |

1          2
2          2
3          1

User Table

id | nome |
2    Caio
3    Julio

Trigger Caio notifications for IMEI 1 and 2 cell phones

    
11.07.2014 / 22:09