Ionic Native FCM - Cannot get the content of the notification when it comes?


#1

Hi,

I’m making an ios app using Ionic platform with push notification (https://ionicframework.com/docs/native/fcm/). After following all the instructions I could find, I’ve been able to receive push notifications on my test devices.
However, there’re a couple of things that still didn’t work as how I expected:

  1. Click on the notification on the shade don’t trigger the event set up in my code except launching the app.
  2. When notifications comes, there is this error showed in log " Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called." and I could not read the content of the notification.

Any help would be so much appreciated.

This is my onNotification:

this.fcm.onNotification().subscribe(data => {
  console.log(data);
  if(data.wasTapped){
    console.log("Received in background");
  } else {
    console.log("Received in foreground");
  };
});

And here is the test payload sending from my server:

{  "notification": {
    "body" : "This week’s edition is now available.",
    "title": "Portugal vs. Denmark",
    "text": "5 to 1",
         "click_action":"FCM_PLUGIN_ACTIVITY"

  },
  "data" : {
    "bookingID": "64",
        "action":"rate"
  },
  "to" : "/topics/samcoIOS",
  "priority" : "high",
      "content_available": true

}