Ph3nol / NotificationPusher

Standalone PHP library for easy devices notifications push.
MIT License
1.18k stars 273 forks source link

How to replace the current device token with the registration_id using GCM facade?[v2.3.4] #165

Open wailaw opened 6 years ago

wailaw commented 6 years ago

There's a case that a registration_id might be returned from the GCM response, in order to replace the corresponding device token.

How could I get that registration_id if exists by using the GCM facade? If parsing a JSON is needed, can anyone provide me an example of that JSON with the registration_id within a GCM facade response. Because I don't know how to produce this kind of response.

Thanks so much for the help!

aliemam commented 6 years ago

Can you explain more? as far as i understand you'r asking how you can get registration token from google (registration_id is channel, gcm use to make push to that device). you are not suppose to do anything, google provides you an sdk for android and ios. use that sdk. get their registration_id and pass it to your backend for further process (store or whatever you want). this registration ids might change any time google decide so you have to get it every time (like in an interval or whenever your app decide to call gcm to get or refresh its registration id). then you replace this registration id with current one you have. or i just answer crap not relevant to your question