FirebaseFCM问题

问题描述

我尝试在客户端/浏览器上构建e通知应用程序,我使用以下代码获取令牌(和“允许的通知”):

const tokenString = document.getElementById("token");
const errorMessage = document.getElementById("error");
const message = document.getElementById("message");
// Your web app's Firebase configuration
var firebaseConfig = {
    apiKey: "AIzaSyBLjMD7aKrdMx6TBUI_3J******",authDomain: "testpushnotif-5bf0e.firebaseapp.com",databaseURL: "https://testpushnotif-5bf0e.firebaseio.com",projectId: "testpushnotif-5bf0e",storageBucket: "testpushnotif-5bf0e.appspot.com",messagingSenderId: "814573483699",appId: "1:814573483699:web:05a5e998bec2f****",measurementId: "G-8MM2RNQG8Y"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
const messaging = firebase.messaging();
messaging
        .requestPermission()
        .then(() => {
            message.innerHTML = "Notifications allowed";
            return messaging.getToken();
        })
        .then(token => {
            tokenString.innerHTML = "Token Is : " + token;
        })
        .catch(err => {
            errorMessage.innerHTML = errorMessage.innerHTML + "; " + err;
            console.log("No permission to send push",err);
        });

使用以下代码发送请求时:

https://pastebin.com/AGDQZm46

回复内容: {“ multicast_id”:1298414817543716554,“成功”:1,“失败”:0,“ canonical_ids”:0,“结果”:[{“ message_id”:“ https://updates.push.services.mozilla.com/米/ gAAAAABfTn0Q3iusZs3EwottZb_Duk88b0zs1vY64YOvDox107kfnApq6Y02WpiHOnnkyZS4hsT-gVnvfIw3M3xkZkmZ9qHcsrI1rCgc5_mukv7gdG9Dtg0bQVL2aRkSVtnNRaCqYCXKk7aHdFW4bqobFppCtDSDS1zuugodpnUZ5-1OecImiyTL6RvxfAKuUaj7sEbgv1Xm“}]}

成功为1,但我的浏览器未收到推送通知

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)