- Issue created by @aguirre.ivan
I am facing an issue where the browser does not receive push notifications in the background when it is completely closed. Foreground notifications work fine, but background notifications are not being processed.
To solve this, I added the onBackgroundMessage handler to the service worker, but notifications are still not displayed when the browser is closed.
Here is the code I tried:
messaging.onBackgroundMessage((payload) => {
const notificationTitle = payload.notification.title;
const notificationOptions = {
body: payload.notification.body,
icon: payload.notification.icon,
};
self.registration.showNotification(notificationTitle, notificationOptions);
});
However, even with this code, background notifications are not being received.
Could someone help me troubleshoot this issue? Is there anything else I should configure in Firebase to ensure background notifications are properly handled?
Any help would be greatly appreciated!
Active
2.0
Code