nativescript-local-notifications: Conflict between nativescript-local-notifications and nativescript-plugin-firebase on iOS

I was using version 3.0.0 of nativescript-local-notifications with nativescript-push-notifications and, as far as the limitations of that other plugin allow, everything was working fine on iOS.

However, after replacing it with nativescript-plugin-firebase, it’s not possible to schedule and display a local notification anymore:

Step by step, this is what’s happening:

  • nativescript-plugin-firebase receives a remote push notification and calls the onMessageReceivedCallback with the following Message (as long as the application is on the foreground, even thought the Push Notifications Capability is enabled):

    {
        "adb_deeplink": "...",
        "message": "...",
        "attachment-url": "...",
        "from": "...",
        "foreground": true,
        "data": {
            "adb_deeplink": "...",
            "message": "...",
            "attachment-url": "...",
            "from": "...",
            "foreground": true
        }
    }
    
  • nativescript-push-notifications schedules a local notification using that data with no at set and forceShowWhenInForeground: true and the following message appears on the console:

    CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/messaging
    /messaging.js:463:20: >>>>>>>>>>> Handle push from foreground
    
  • onMessageReceivedCallback from nativescript-plugin-firebase is invoked again with the following Message:

    {
        "forceShowWhenInForeground": true,
        "foreground": true,
        "data": {
            "forceShowWhenInForeground": true,
            "foreground":true
        }
    }
    

If the App is in background, onMessageReceivedCallback won’t be called until the App is opened, but then the same whole thing happens.

Tested on an iPhone 7 with iOS 10.3.1.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 26 (22 by maintainers)

Most upvoted comments

Man, you’re kicking a$$, looks good to me! Perhaps remove the package.json version bump from your PR (I can ignore it, no biggie). I will release 7.0.0 soon and I’d love to include this.

To eaily test it, you could change https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/d0f3f3d478b3e3a121d36be4c61cee7e738df7a0/src/messaging/messaging.ios.ts#L529 to if (1 === 1) in your node_modules folder. If that helps I can add the change I proposed in my previous comment.