Push "data message" not being received with FirebasePlugin

I’m using FirebasePlugin with Ionic in order to receive both “data message” and “notifications messages” because i need some notifications are managed by user and other only by app. I have followed firebase documentation to create the content of both types of notifications (https://firebase.google.com/docs/cloud-messaging/concept-options?hl=es-419) This is the expected behaviour:

  • App foreground
    Data messages - received and managed by app
    Notification messages - received and managed by app
  • App background
    Data messages - received and managed by app
    Notification messages - received and managed by user (push has to be shown in phone action bar)

This is the code where i’m tryint to receive the push notifications acording with FirebasePluggin doc:
FirebasePlugin.onNotificationOpen(notification => {
});

The issue is i’m not receiving “data messages”. Any idea about how to receive de “data messages” with this pluggin?

-Addtional info - according to firebase doc these are the two types of notifications:
DATA MESSAGES
{
“to” : “bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1…”,
“data” : {
“fieldOne” : “content”,
“fieldTwo” : “content”
},
}
NOTIFICATION MESSAGES
{
“to” : “bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1…”,
“notification” : {
“fieldOne” : “content”,
“fieldTwo” : “content”
}
}

I wasn’t able to do this either. I tried both @ionic-native/fcm and @ionic-native/firebase-messaging.

Here’s my frontend code for firebase-messaging:

this.firebaseMessaging.onBackgroundMessage().subscribe(message => {
               console.log(‘got message in background’,message);
               this.savedChats.push(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. Still waiting on some answer