Although my firebase-messaging-sw.js is functioning properly in displaying background notifications, I have encountered an issue where the icon does not show up even though notification.title and notification.click_action are working correctly.
Here is the code snippet from my service worker's messaging.setBackgroundMessageHandler:
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);
This is where I included the link to my icon: https://i.sstatic.net/JOLcZ.png
And this is the visual outcome:
https://i.sstatic.net/GskwO.png
Your assistance is greatly appreciated. Thank you for your time.