Firebase javascript后台服务人员通知图标不显示
我的firebase-messaging-sw.js可以正常显示后台通知,但在notification.title和notification.click\u操作正常工作时,它没有显示图标 这是我的服务人员的消息。setBackgroundMessageHandlerFirebase javascript后台服务人员通知图标不显示,javascript,firebase,firebase-cloud-messaging,iis-8,service-worker,Javascript,Firebase,Firebase Cloud Messaging,Iis 8,Service Worker,我的firebase-messaging-sw.js可以正常显示后台通知,但在notification.title和notification.click\u操作正常工作时,它没有显示图标 这是我的服务人员的消息。setBackgroundMessageHandler messaging.setBackgroundMessageHandler(function (payload) { console.log('[firebase-messaging-sw.js] Received backgrou
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: '/image/logo.png'
};
return self.registration.showNotification(notificationTitle,
notificationOptions);
}))
这是我放置图标的地方
这是结果
感谢您抽出时间提供帮助。将您的图像放入根目录并检查 请参阅此网址-
https://github.com/firebase/quickstart-js
将映像放入根目录并检查 请参阅此网址-
https://github.com/firebase/quickstart-js
经过几天的尝试,我通过添加
{“icon”:“/image/logo.png”}
在FCM服务器Post请求正文中,而不是默认在firebase-messaging-sw.js中
IIS服务器需要为托管的web项目提供静态内容,以便logo.png可以公开
这是我更新后的Post请求正文,采用JSON格式
{
"notification": {
"title": "New Appointment Requested",
"body": "5 to 1",
"icon": "/image/logo.png",
"click_action": "<host>/subpage"
},
"to": "token"
}
{
“通知”:{
“职务”:“要求新的任命”,
“正文”:“5比1”,
“图标”:“/image/logo.png”,
单击“操作”:“/子页面”
},
“收件人”:“令牌”
}
尝试了几天后,我通过添加
{“icon”:“/image/logo.png”}
在FCM服务器Post请求正文中,而不是默认在firebase-messaging-sw.js中
IIS服务器需要为托管的web项目提供静态内容,以便logo.png可以公开
这是我更新后的Post请求正文,采用JSON格式
{
"notification": {
"title": "New Appointment Requested",
"body": "5 to 1",
"icon": "/image/logo.png",
"click_action": "<host>/subpage"
},
"to": "token"
}
{
“通知”:{
“职务”:“要求新的任命”,
“正文”:“5比1”,
“图标”:“/image/logo.png”,
单击“操作”:“/子页面”
},
“收件人”:“令牌”
}
它也不工作:(我把它放在根目录下。它也不工作。)(我把它放在根目录下。