Cordova-plugin-firebasex: Foreground notifications on iOS only show after you force quit and relaunch the app

Created on 20 Aug 2019  Â·  4Comments  Â·  Source: dpa99c/cordova-plugin-firebasex

Bug report

Current behavior:
After you accept the permission prompt on iOS and send push notifications while the app is in the foreground, the app receives the data but doesn't display a native notification. If you then force quit the app and relaunch it and while the app is in the foreground send push notifications again they do come display as native notifications.

This has been tested on test app (https://github.com/dpa99c/cordova-plugin-firebasex-test) which produces the same results.

Expected behavior:
After you accept the permission prompt on iOS and send push notifications while the app is in the foreground, you should see a native notification.

Steps to reproduce:

  • Run the test app (https://github.com/dpa99c/cordova-plugin-firebasex-test), making sure to have gone through all the setup steps as documented.
  • Accept the push notification prompt and keep the app in the foreground
  • Using the device token that's displayed on screen send a push notification to the device, the message will appear in the activity log but not trigger a native notification.

The payload used was as follows (device tokens have been removed):
{ "registration_ids": [ ], "notification": { "title": "Hello there", "body": "Have a great day", "sound": "default" }, "data": { "notification_foreground": "true" } }

Environment information

  • Cordova CLI version

    • 9.0.0

  • Cordova platform version

    • ios 5.0.1

  • Plugins & versions installed in project (including this plugin)

    • cordova-custom-config 5.1.0 "cordova-custom-config"

      cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"

      cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"

      cordova-plugin-customfcmreceiver 1.0.0 "Custom FCM Receiver"

      cordova-plugin-firebasex 6.0.6 "Google Firebase Plugin"

      cordova-plugin-whitelist 1.3.4 "Whitelist"

  • Dev machine OS and version, e.g.

    • OSX



      • ProductName: Mac OS X


        ProductVersion: 10.14.5


        BuildVersion: 18F203



_Runtime issue_

  • Device details

    • iPhone 6s

  • OS details

    • iOS 12.4

_iOS build issue:_

  • Node JS version

    • v12.6.0

  • XCode version

    • 10.3

bug ios runtime issue

All 4 comments

Same problem

I can repro this - will investigate and fix

I have now tested with version 6.1.0 and can confirm that the bug has now been fixed, thanks @dpa99c.

@dpa99c I am receiving the same issue, while the app is in the background the native notification comes but while the app is in foreground its not displaying it.

Here is the code I am getting as message from onMessageReceived method:

[Log] message (raven.min.js, line 2) Object android: "{\"notification\":{\"icon\":\"https:\\/\\/www.arcedior.com\\/assets\\/images\\/favicon\\/apple-icon-72x72.png\"}}" aps: {alert: {title: "title", body: "body of message."}, sound: "mySound"} data: "{\"image\":null,\"resurl\":\"\",\"notification_android_icon\":\"https:\\/\\/www.arcedior.com\\/assets\\/images\\/favicon\\/apple-icon-72x72.png\",\"sound\":\"m…" gcm.message_id: "1568358726993491" gcm.notification.notification_android_icon: "https://www.arcedior.com/assets/images/favicon/apple-icon-72x72.png" gcm.notification.notification_foreground: "true" gcm.notification.resurl: "" google.c.a.e: "1" messageType: "notification" name: "my_notification" notification: "{\"image\":null,\"resurl\":\"\",\"notification_android_icon\":\"https:\\/\\/www.arcedior.com\\/assets\\/images\\/favicon\\/apple-icon-72x72.png\",\"sound\":\"m…" Object Prototype
Platform: IOS
Cordova v: 9.0.0 ([email protected])
Xcode v: Version 10.3 (10G8)

Any help is most appreciated and thank you so much for this great plugin!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xurdep picture xurdep  Â·  5Comments

marcelonnunes picture marcelonnunes  Â·  3Comments

DavidStrausz picture DavidStrausz  Â·  3Comments

satyam41295 picture satyam41295  Â·  4Comments

hastom picture hastom  Â·  6Comments