且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Firebase 云消息/通知未收到.JS

更新时间:2022-06-10 22:15:35

我的 firebase-messaging-sw.js 文件有问题.我已经通过以下代码解决了这个问题.

There was an issue with my firebase-messaging-sw.js file. I have resolved this by following code.

importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-messaging.js');

var config = {
    apiKey: "AIzaSyDtg4aQMQW67Jla1nUzrTTSEhVqpUeqKXI",
    authDomain: "payxxxxxxx.firebaseapp.com",
    databaseURL: "https://pxyxxxxx.firebaseio.com",
    projectId: "pxxoll-pxxxs-fxxx",
    storageBucket: "pxxx-pxxx-fxxxx1.apxxxot.com",
    messagingSenderId: "2xxxx5xxx"
  };
  firebase.initializeApp(config);


const messaging = firebase.messaging();