Can't get notification payload from firebase-sw on Ionic PWA


I’ve searched a lot for this problem that I’m stuck on for a week. I have an Ionic PWA project that receive some notifications from firebase, I can receive the notifications with no problem and can get the payload on foreground (app is open), but I cant get the payload when the app is closed and I don’t figure out what is goning on, so I came here to ask the masters to help me.

messaging.setBackgroundMessageHandler(function(payload) {
    var notificationTitle = 'Teste';
    var notificationOptions = {
      body: 'Background Message body.',
      tag: 'campanhas',
      icon: ''

   return self.registration.showNotification(notificationTitle,

self.addEventListener('notificationclick', function(event) {

     type: "window"
   }).then(function(clientList) {
     for (var i = 0; i < clientList.length; i++) {
       var client = clientList[i];
       if (client.url == '/' && 'focus' in client)
       return client.focus();
     if (clients.openWindow)
      return clients.openWindow('/');

and on my provider for the notifications, I use this code:

public receiveMessage() {
  this.messaging.onMessage((payload) => {

I call this provider on my tabs-page:


So, can anyone help me to get the payload when the PWA is closed?


I’m having the same problem! I tried @ionic-native/fcm and then @ionic-native/firebase-messaging. Both seem to promise this functionality but I haven’t been able to get either to work.

I get the push notification just fine but the callback here never fires.

this.firebaseMessaging.onBackgroundMessage().subscribe(message => {
               console.log(‘got message in background’,message);

I’d expect that this would save the data from the notification but no. I can find examples for the cordova onBackgroundMessage but not the ionic wrapper. I can’t imagine there’s a function for onBackgroundMessage but no ability to receive and process background messages.