arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1k stars 1.55k forks source link

Push notification on ios does not show when app in background #1067

Closed ColDrekken closed 5 years ago

ColDrekken commented 5 years ago

Describe the bug Hello,

Since, i guess ios 12.2 but im not fully sure, my app does not show push notifications in the notification center of ios anymore. Therefor i already tested my whole way of generating push request and all seems working there.

Certificates are well, using APNS Key .p12 in firebase. using latest google-Info.plist file.

I have read a few post here where it looks similar but no one seem fully match to my issue.

Also if i got the app in foreground i see the incoming pushes in log! for example from a postman request:

Received data message: { body = "Body of Your Notification in Data"; "collapse_key" = "my.tiny.app"; from = 755868927454; "key_1" = "Value for key_1"; "key_2" = "Value for key_2"; notification = { body = "Body of Your Notification"; e = 1; title = "Title of Your Notification"; }; title = "Title of Your Notification in Title"; }

i see also in Log:

FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at: https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging to ensure proper integration.

But it seems not related to this problem as it has no effect if i set FirebaseAppDelegateProxyEnabled to NO or YES

Does anyone has an idea, i tried so many things over the past 5 days but nothing works....

To Reproduce Steps to reproduce the behavior:

  1. Put the app in background or close it.
  2. make something to receive a push notification.

Expected behavior If App is closed or in background -> Push should show on ios notification center.

Plugin Version call-number 0.0.2 "Cordova Call Number Plugin" com-badrit-base64 0.2.0 "Base64" com.synconset.imagepicker 2.1.8 "ImagePicker" cordova-admobsdk 7.37.0 "Google Mobile Ads SDK for Cordova" cordova-clipboard 1.2.1 "Clipboard" cordova-open-native-settings 1.5.2 "Native settings" cordova-plugin-admobpro 2.37.2 "AdMob Plugin Pro" cordova-plugin-app-version 0.1.9 "AppVersion" cordova-plugin-apprate 1.4.0 "AppRate" cordova-plugin-background-mode 0.7.2 "BackgroundMode" cordova-plugin-badge 0.8.8 "Badge" cordova-plugin-camera 4.0.3 "Camera" cordova-plugin-crop 0.3.1 "CropPlugin" cordova-plugin-device 2.0.2 "Device" cordova-plugin-dialogs 2.0.1 "Notification" cordova-plugin-email-composer 0.8.15 "EmailComposer" cordova-plugin-extension 1.5.4 "Cordova Plugin Extension" cordova-plugin-facebook4 1.10.1 "Facebook Connect" cordova-plugin-file 6.0.1 "File" cordova-plugin-file-transfer 1.7.1 "File Transfer" cordova-plugin-firebase 2.0.5 "Google Firebase Plugin" cordova-plugin-geolocation 4.0.1 "Geolocation" cordova-plugin-globalization 1.11.0 "Globalization" cordova-plugin-inappbrowser 1.7.2 "InAppBrowser" cordova-plugin-inapppurchase 1.1.0 "In App Purchase" cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard" cordova-plugin-ionic-webview 4.0.1 "cordova-plugin-ionic-webview" cordova-plugin-nativestorage 2.3.2 "NativeStorage" cordova-plugin-sim 1.3.3 "SIM" cordova-plugin-splashscreen 4.1.0 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-whitelist 1.3.3 "Whitelist" cordova-plugin-x-socialsharing 5.4.4 "SocialSharing" cordova-sqlite-storage 2.6.0 "Cordova sqlite storage plugin" es6-promise-plugin 4.2.2 "Promise"

Smartphone

Ionic:

ionic (Ionic CLI) : 4.12.0 (/usr/local/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.5 @ionic/app-scripts : 3.2.1

Cordova:

cordova (Cordova CLI) : 7.1.0 Cordova Platforms : browser 5.0.4, ios 4.5.5 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 26 other plugins)

System:

ios-deploy : 1.9.2 ios-sim : 5.0.10 NodeJS : v8.9.4 (/usr/local/bin/node) npm : 6.3.0 OS : macOS Mojave Xcode : Xcode 10.2.1 Build version 10E1001

ColDrekken commented 5 years ago

I found out something more, but also some more confusion...

i got a ipad which was running on ios 12.1.4 ---> here same issue no push notification in the centre or lockscreen or banner when app was in background.

i updated the ipad to 12.3 and wonder now it works as expected!

but... doing the same on my iphone 6 which has 12.1 updated to 12.3 before doe not change anything. Still no notification visible.

Then i checked the iphone native settings for my app :

on my ipad i see as expected: Under Notifications : Banners,Sounds, Badges.

Going one lever deeper on notifications ALERTS shows me active:

Lock Screen, Notification Centre, Banners Banner Style: Temporary

i checked the same stuff on my iphone:

Under Notifications: just "Badges"

going deeper on ALTERS:

Lock Screen, Notification Centre (Banners is missing)

iphone6_Notifications

iphone6_Settings

Normaly it should be like below , no?

IMG_6092

I cant find the difference, both is done with same code. Only differnce is ipad and iphone.

On my iphone Xs running on 12.2 i got the same result as on the iphone 6 running on 12.3

Hope somebody could help me with that confusing stuff...

Recognise something more during writing this lines:

Normaly, on fresh installed app i ask for push permission firstly on a specific screen, not the start screen. But, without change anything here, it just ask for push permission right after signup or login into my app.

btw, app is available on store "Base Chat" just in case somebody want to see the issue live.

thx in advanced and best regards

ColDrekken commented 5 years ago

Well, i found the reason... and honestly i was just stupidly blind.

Because of this https://github.com/arnesson/cordova-plugin-firebase/issues/1048

i was using this https://github.com/katzer/cordova-plugin-badge to set the badge. But the problem is, on a new install, cordova-plugin-badge just fires the permission request automatically and only set permissions for the badge...

so there if it comes to cordova-plugin-firebase permissions request it returns just true but did not set the permissions for banner and Notification Centre.

I will leave this here, maybe somebody else was stupid like me :)