DEV Community

loading...

Discussion on: Add Web Push Notifications to your Ionic PWA

Collapse
ognjengt profile image
Ognjen Gatalo

Hi David,
Excellent tutorial, you covered all of the things perfectly! Just a heads up that when sending the notification when the app is in the foreground does not log the payload in the console, I'll try to post the solution here if I find it.

Best,
Ognjen

Collapse
daviddalbusco profile image
David Dal Busco Author • Edited

Hi Ognjen,

Thank you for the feedback!

That would be cool if you find a solution. When I wrote the tutorial I was able to log the notifications when the app was in foreground as I displayed above but yes maybe that isn't valid anymore.

// Listen to messages when your app is in the foreground
messaging.onMessage((payload) => {
    console.log(payload);
});

Looking forward to hear about it!

Best
David