I am trying to use push notification for my web site..
I am trying fcm. In the Google documentation (https://firebase.google.com/docs/cloud-messaging/js/client) they told us to use gcm_sender_id in manifest.json
file, but I don't find it any where in firebase page https://console.firebase.google.com/project/fir-98798789/overview
Also they have mentioned
Don't confuse the "browser sender ID" with the project-specific sender ID value shown in your Firebase project settings. The browser sender ID for manifest.json is a fixed value, common among all FCM JavaScript clients.
Click the Cloud Messaging tab next to the General tab. The Project credentials section appears. The Project credentials section displays the Firebase Cloud Messaging token, Sender ID, and the Server key. Copy Sender ID.
The sender ID that you enter in the manifest.json of your web app is independent of your Firebase project. It is the same for all web apps (yours, mine, everybody's):
"gcm_sender_id": "103953800507"
So just copy/paste the line above into the manifest.json for your project. See this section of the FCM documentation.
Seems like Firebase Messaging actually works even if you skip this step. Look at https://web-push-demo-11213.firebaseapp.com as an example.
This demo website doesn't even have a manifest but is able to talk to FCM, get tokens, refresh them and so on.. Sorry you won't be able to actually send a push though since you don't know the auth key, but you get the idea - I've tested it, it works.
In light of this, not sure why this manifest requirement though.
Also, looking at the FCM SDK source on github, looks like they only throw an error if you have a manifest with a gcm_sender_id
that's not 103953800507
. For everything else (the gcm_sender_id
field in manifest missing, or even the manifest itself missing from the website), it works as fine.
See the code here: https://github.com/firebase/firebase-js-sdk/blob/master/packages/messaging/src/controllers/window-controller.ts#L329-L355
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