larpon/QtFirebase

iOS Background notification - not working

nero08 opened this issue ยท 20 comments

Hello,

I can't receive any notification in background, it's fired when the application become active.
Did I forgot a setting? I activate Remote notification background on xcode and push notification capabilities.

Did you uploaded the APNs Authentication Key in the firebase console?
I tested it right now and it works for me.

Yes it's upload, I received the notif only when application become active, it's on IOS 11
Same problem as https://stackoverflow.com/a/46458432

What is your version of Firebase and Firebase CPP SDK?

Are you using the latest firebase version on ios and cpp sdk?

I tested it again. And it works fine 4 me.
Steps 4 you to do:

  1. Xcode enable push notifications
  2. Xcode enable push notifications in background ( dont know it this is necessary)
  3. check your APN CERTIFICATE in the firebase console
  4. Deninstall the app and try a fresh one pls do a RELASE Build.

I'm have the same issue. I just receive the message when the app is open. It's possible to see in the log, however when the app enters in background the log shows "Disconnect FCM service" and nothing more is said, no notifications... I'm gonna check again the firebase version, however I'm not optimist about that... T--T

@driele-torres can you see what gives that log message? Is it coming from QtFirebase (should have "QtFirebase" in it's name/prefix) or the Firebase SDK?

@Larpon Well, for what I saw it came from Firebase SDK. The prefix is 'FCM', when the log is from QtFirebase the prefix is the name of the qml where it's called (the siglenton). And the right msg is : "Disconnect FCM service". I already checked the firebase SDK and Qt Firebase and that IOS files in 'src' version, and the APN's certificated. Everything is ok about the versions and configurations, I can recieve the messages, they are shown in the log when the app is open. However when in background nothing happens, no notifications at all. Do I have to change that AppDelegate? Because I am not sure if I have to implement what is said in the ios docs of Firebase, cause I'm using the QtFirebase.... I already did what @isipisi281 said... I'm testing it in a IOS 11... (I'm lost... heheh)

Are you sending both times the same notoficaten?
If yes, you have to change it.
if the notofication message is the same you did send before, there is no update emited.

You do not have to edit the AppDelegate file.
We are running messaging on 10 apps and all of them work fine with ios 11.
There is something wrong with you code or with your provisioning profiles.

Did you checked the provisioning if pushnotifications are enabled?

@isipisi281 and @Larpon thanks anyway, I have checked everything and compared all the configurations... Probably, there's something I couldn't find. In your QtFirebase Example, is there a way to send notifications or it is sent automatically by a server to test, or none of it?

@driele-torres - Unfortunately not. I've been thinking about adding some kind of script or setup that would fire notifications every 10 mins. to the QtFirebase Example app or something. But I'm really busy with my game so I haven't had time to look into it yet - it's on my TODO - but I can't promise when or if it'll land :/

@driele-torres this is not possible. To run the example on lets say ios you need the provisioning profiles from larpon. If you dont have them you cant receive notifications bcs the app is not signed properly.

If you let me look into your code mybe i could help you.

Is this problem solved? Can i close it?

... also remember that upon initialization, the app should ask for permission to send notifications (you get a permission pop-up message) - and you should of course allow it to do so :)

... Firebase also adheres to the "Limit Ad Tracking" settings in iOS - it could maybe have something to do with those?
... and you could check your device's Settings > Notifications > <your QtFirebase app> to see if everything is enabled

I use latest version of both
Ios: 11.2
FireBase: 4.3

This is my log when press home button

2017-12-06 12:28:23.050582+0330 Project[3036:928380] FCM: Disconnect F
CM service
2017-12-06 12:28:23.402812+0330 Project[3036:928767] TIC Read Status [3:0x0]: 1:57
2017-12-06 12:28:23.403806+0330 Project[3036:928767] TIC Read Status [3:0x0]: 1:57
When back to app
2017-12-06 12:28:48.224057+0330 Project[3036:928380] FCM: Connected to FCM
2017-12-06 12:28:48.904962+0330 Project[3036:928380] FCM: Received message

@cinohee - thanks for elaborating - I have a feeling it might be this again - I'll just check with my own iOS device

Finally I resolved the problem
Please edit files in example
1- add
screen shot 2017-12-06 at 5 09 10 pm
2-
screen shot 2017-12-06 at 5 12 08 pm
3- Add UserNotifications framework !important

LIBS += \
    -framework StoreKit \
    -framework Security \
    -framework SystemConfiguration \
    -framework UserNotifications \

**4- Remove this section from info.plist file **

<key>FirebaseAppDelegateProxyEnabled</key>
<false/>

Worked like charm ;-)

Congrats ๐Ÿ‘ .
I am very soon going to be using this.

Yeah - really good catch @cinohee

I have commented it and added an explanation in QtFirebaseExample

@cinohee very nice! I was with the same problem... however, as I had short time I just started using the app delegate to handling the notification instead QtFirebase in ios. I am gonna refactor my code in order to use it again in IOS. o/ So cool! The key point was remove this :<key>FirebaseAppDelegateProxyEnabled</key><false/>