I am trying to get the Firebase Cloud Messaging to work. I am just trying a test for now. What I have done is everything in this post:
https://firebase.google.com/docs/cloud-messaging/js/client?authuser=0#retrieve-the-current-registration-token
Then at that end you see this:
messaging.getToken().then((currentToken) => {
I then copy this currentToken
and use it as a test by going to Firebase (the website) > Grow (sidebar) > Cloud Messaging (sidebar) > Send your first message (button) > Fill in a 'Notification title' and 'Notification text' > Send test message (blue button to right) > Add the currentToken
I copied from above OR check a previously added one > Test (button) ... (see screenshot below)
I assume after clicking the 'Test' button it should send a notification to my phone (where I allow notifications and got the token from). I tested this with my pc and did not get a response either. Using Chrome on my pc and laptop for what that matters.
What am I missing here?
I was missing an important part of adding the gcm_sender_id
in the manifest.json
. I followed this link exactly and it worked perfectly. You can use the Firebase Cloud Messaging testing platform instead of the Postman approach from the article:
https://codeburst.io/how-to-add-push-notifications-on-firebase-cloud-messaging-to-react-web-app-de7c6f04c920
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With