【发布时间】:2017-11-09 13:15:45
【问题描述】:
我第一次做 fcm 网络通知并收到一条消息
{ from: "205864560478", collapse_key: "do_not_collapse" }
我的代码是
messaging.onMessage(function(payload) {
console.log("Message received. ", payload);
// ...
});
还有我的 firebase-messaging-sw.js
const messaging = firebase.messaging();
messaging.setBackgroundMessageHandler(function(payload) {
console.log('[firebase-messaging-sw.js] Received background message ', payload);
// Customize notification here
const notificationTitle = 'Background Message Title';
const notificationOptions = {
body: 'Background Message body.',
icon: '/firebase-logo.png'
};
return self.registration.showNotification(notificationTitle,
notificationOptions);
});
请帮忙。我不知道为什么我会收到这个错误 我完美地为 ios 和 Android 工作。 我的 web 项目在 localhost 中并且没有 https
【问题讨论】:
标签: angularjs firebase push-notification firebase-cloud-messaging