Reputation: 2441
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:
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?
Upvotes: 4
Views: 7728
Reputation: 1580
I had the same issue trying to send a message from the Firebase cloud console but to an emulated Android device instead. No message would come through.
To make it work I had to uninstall and reinstall the app, simple as that.
Answering this very old question because it's the first result that came up for my Google search and I wasted a lot of time "fixing" it. :)
Upvotes: 0
Reputation: 2441
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:
Upvotes: 2