Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
benwhomsley opened this issue Aug 20, 2019 · 5 comments
Assignees
Labels
bug Something isn't working properly ios relates to iOS platform runtime issue An issue related to app runtime

Comments

@benwhomsley
Copy link

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
@Lucab95
Copy link

Lucab95 commented Aug 26, 2019

Same problem

@dpa99c dpa99c added bug Something isn't working properly ios relates to iOS platform runtime issue An issue related to app runtime labels Aug 30, 2019
@dpa99c
Copy link
Owner

dpa99c commented Aug 30, 2019

I can repro this - will investigate and fix

@dpa99c dpa99c self-assigned this Aug 30, 2019
@dpa99c dpa99c closed this as completed in cef2758 Sep 3, 2019
@benwhomsley
Copy link
Author

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

@sanket-webmavens
Copy link

@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!!

@yuancure
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly ios relates to iOS platform runtime issue An issue related to app runtime
Projects
None yet
Development

No branches or pull requests

5 participants