0

I'm currently using ionic to develop an app with firebase push notification feature .I want the app to receive notification and store the notification data locally(without tapping notification) to be shown on the app. Thanks to Phonegap-Plugin-Push, I'm manage to receive notification and handle callback function when my app is on foreground and background. My problem is When my app is closed/ killed there's still notification pop out on notification shade but callback function is not called. After some research, i found this link can help me. Unfortunately, there's still some issue about force-start which I have post on github. While waiting for response, I would like to ask is there any alternative way to achieve this? (e.g: another plugin, another method, background service for ionic?)

Ekova Sam
  • 1
  • 1

1 Answers1

0

You can use Ionic native firebase cloud messaging (https://ionicframework.com/docs/native/fcm/) plugin it is spport android and ios platform.

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

And it is onNotification() function for you can know how you get notification foreground or background.

Jaydeep Kataria
  • 817
  • 10
  • 22