How do I display the text of a notification when the user opens this notification?

0

I'm creating an app with the phonegap and using the cordova-plugin-firebase to send notifications to the android, until then, I'm getting the notification, but when I "open" the notification I can not show the contents of it. message)

window.FirebasePlugin.onNotificationOpen(function(notification) {
     alert(JSON.stringify(notification));
}, function(error) {
     console.error(error);
});

Everything that appears in the alert is google.sent_time google.ttl tap from google.message_id google.priority collapse_key according to the image. Does anyone know how I can get the information and display it to the user?

    
asked by anonymous 23.07.2018 / 22:06

1 answer

0

I actually got the problem not in the app, but where I send the notification, with FCM I need to send title and message to when the app is in the foreground and another to when it is in the background, I was just sending from the foreground, so when I received notification with the open app appeared, but not with the app closed, when opening the notification did not appear, I resolved sending it

"to" : "<DEVICE TOKEN>"
, 
"notification": {
    "title": "This is used in the foreground",
    "body": "This is used in the foreground"
},
"data":{
      "title":"This is used in the background",
      "body":"This is used in the background"
}

as this link link

    
25.07.2018 / 14:09