Hi alls,
I have an ionic 4 angular PWA project and want to use firebase cloud messaging.
Registration with firebase is ok aénd I can get token my problem that messaging.onMessage never called and the notification catched by OS
this my firebase-messagin-sw.js
importScripts('https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/7.12.0/firebase-messaging.js');
const messaging = firebase.messaging();
messaging.setBackgroundMessageHandler(function(payload) {
const notificationTitle = 'Background Message Title';
const notificationOptions = {
body: 'Test ' + JSON.stringify(payload),
};
return self.registration.showNotification(notificationTitle,
notificationOptions);
});
other staff is made in my notification service
Any idea ?