curl --header "Authorization: key=blahblahblah" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"blahblahblah\"]}"
Currently i am able to send push notification though the command above. In order to send the notification to user, i need to get the registration id from user. What if I want to push notification to everyone (who subscribed to that notification)? And how I get their registration ID?
*Note: what I want is: push a notification to everyone when my something in the website updated.
Link to my project: Github
I learnt push notification + sw from here: Google Developer
What you'd need to do is keep track of the registration ids for all of your clients in a backend datastore, and then use all of those registration ids when sending notifications from a backend process. It can't all be done client side in a real-world system—the
curl
trick is there in the sample frontend code as a hack to work around the lack of a backend.There are a few different backend examples out there that I know about: