FCM push notifications doesnt work if System notifications settings is toggled

333 views
Skip to first unread message

Anand Agarwal

unread,
Feb 27, 2023, 7:25:33 PM2/27/23
to Firebase Google Group
Hey I am building a chat app,
I use FCM for web notification I am able to receive notifications but when I change the system settings 
1.Manually like toggle it off then on in some seconds or?
2. If I activate DND and deactivate it or?
3. If you are on zoom call sharing your screen the system notifications setting changes automatically?

Then the push notifications are not working as expected it always says “ This site has been updated in the background.” 

/* Handle incoming messages while the app is not in focus
(i.e in the background, hidden behind other tabs, or completely closed).*/
if (messaging) {
messaging.onBackgroundMessage((payload) => {
const { title, body, icon, ...restPayload } = payload.data;
const notificationOptions = {
body,
data: restPayload,
// path to your "fallback" firebase notification logo
icon: icon || './favicon.ico',
};
return self.registration.showNotification(title, notificationOptions);
});
}

Can anybody help me I can show exactly what I am doing if someone can help me?


Reply all
Reply to author
Forward
0 new messages