Notification Hell


#1

Hi,
I’ve been fighting with notifications in an ionic v1 app for most of a month. I’m using cordova-plugin-fcm-with-dependecy-updated to receive notifications. I’m receiving notifications on the device for both topics and single device messages. However, I don’t get the handoff from the plugin to my code. I’m doing the FCMPlugin set-up stuff in ionic.Platform.ready(). Like this:

  function setupNotifications() {
    console.log( "Initializing Notifications" )
    FCMPlugin.subscribeToTopic('marketing').then(function (arg)
    {
      console.log( `HERE HERE HERE ${arg}`);
    });
    //
    FCMPlugin.getToken(
      function (token) {
        alert('Token: ' + token);
        console.log('Token: ' + token);
      },
      function (err) {
        alert('error retrieving token: ' + token);
        console.log('error retrieving token: ' + err);
      });
    //
    FCMPlugin.onNotification().subscribe(data => {
      if(data.wasTapped){
        console.log("Received in background");
      } else {
        console.log("Received in foreground");
      }});
    //
    FCMPlugin.onTokenRefresh().subscribe(token => {
      console.log( "TOKEN REFRESH");
    });

None of my code ever gets called. Is there a way to trace it from the ObjC code into what it’s trying to do instead of calling my code?


#2

Can you tag your post with ionic-v1. I would love to help but I never worked with anything pre ionic 2.

Do you get any of those console logs to work on non of them is called?


#3

None of the console messages are called.