dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
571 stars 462 forks source link

Foreground notifications on iOS only show after you force quit and relaunch the app #109

Closed benwhomsley closed 5 years ago

benwhomsley commented 5 years ago

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:

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

Runtime issue

iOS build issue:

Lucab95 commented 5 years ago

Same problem

dpa99c commented 5 years ago

I can repro this - will investigate and fix

benwhomsley commented 5 years ago

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

sanket-webmavens commented 5 years ago

@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 (cordova-lib@9.0.1) Xcode v: Version 10.3 (10G8)

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

yuancure commented 1 year ago

I'm having the same issue. "foreground notifications" not to display on first run. "data": { "notification_foreground": "true" } } Confirmed with Version 14.2.1 and 16.0.0. Xcode 13 iOS 6.2.0