如何在firebase中获取网站的gcm_sender_id

scr*_*ie1 11 javascript firebase firebase-cloud-messaging

我正在尝试为我的网站使用推送通知..

我正在尝试fcm.在google文档(https://firebase.google.com/docs/cloud-messaging/js/client)中,他们告诉我们在mnifest.json文件中使用gcm_sender_id,但我在firebase页面https中找不到任何位置:/ /console.firebase.google.com/project/fir-98798789/overview

他们也提到过

请勿将"浏览器发件人ID"与Firebase项目设置中显示的项目特定发件人ID值混淆.manifest.json的浏览器发件人ID是固定值,在所有FCM JavaScript客户端中很常见.

谢谢,

Fra*_*len 31

您在Web应用程序的manifest.json中输入的发件人ID与Firebase项目无关.对于所有网络应用程序(您的,我的,每个人)都是一样的:

"gcm_sender_id": "103953800507"
Run Code Online (Sandbox Code Playgroud)

因此,只需将上面的行复制/粘贴到项目的manifest.json中即可.请参阅FCM文档的此部分.


Bin*_* Ho 7

转到https://console.firebase.google.com -> 选择您的项目。

设置->云消息->项目凭据->发件人 ID

希望这有帮助!