Add the possibility to send background notifications

Created on 6 March 2025, about 1 month ago

Problem/Motivation

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.

Proposed resolution

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!

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇦🇷Argentina aguirre.ivan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024