-
-
Notifications
You must be signed in to change notification settings - Fork 474
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
Can't receive notifications in background #81
Comments
Looks as though you have not requested/granted permission for remote notifications on iOS |
Thxs for the response, I add hasPermission/grantPermission and i now i have _hasPermission: YES
But i haven't the expected :
An sample of my message :
|
Try to build & run the example app and use its FCM v1 API messaging client to send the predefined notification messages. |
I am having this issue too on iOS devices.
In xcode project, capabilities I then tested sending messages directly from Google FCM console to make certain it wasn't my server sending the message incorrectly and I get the same results as if it were sent from my server. Cordova CLI: 9.0.0 ([email protected]) I have my android version working but I am still using |
in Xcode, after adding
But when the app was installed I did accept push notifications...but oddly, when I go to iPhones |
figured out my issue. Turns out Previous version returned an object - which had a key of
Where as the firebasex version just evaluates a boolean response:
Once I appended my code, my app asked for permissions properly and now everything works as it should. that one took me for a spin Mr Dave Allen. The break changes section doesn't account for hasPermission/grantPermission changes so I just assumed my original |
@rolinger Apologies, this was sloppiness on my part: I had updated iOS to return a boolean result to |
This fix has been published as v6.0.5 @nvelin-zaggo this should resolve your issue (you may need to update you usage of |
@dpa99c - I guess I don't understand why the change to boolean at all - or even the onMessageOpen to onMessageReceived?. Keeping it with Regardless, thanks. |
@dpa99c or anyone answer this 'related' question please? Trying to get iOS notifications to work I noticed on the iPhone that the devices token id changed a few times. And each time I had to register the new token ID for specific topics I am testing with - which got me thinking. What happens to the user topic subscriptions when the device token changes? When I detect a token change, do I have to un-subscribe the users original token from all the topics they were subscribed to and then re-register the user for all the same topics using the new token? Or is this somehow auto-managed in the background -where FCM auto removes bad tokens and reassigns new tokens for all the user subscribed topics? |
@rolinger Very good questions, I'm currently searching for this kind of answers as well. Since migrating from |
@svzi - I found answers to my own questions - you need to re-register the user for their existing topics. Currently I am now doing that through my back end server using php-fcm (https://github.com/rolinger/php-fcm) - so I pass the old tokenID to my server, unsubscribe the tokenID from all their subscribed topics, then subscribe the users new tokenID to all the same topics. I have requested a new feature to Dave Alden (firebasex author) to integrate this ability right into the plugin so it can all be managed easier and faster in real time directly from the app on the users phone. As far as not getting iOS notifications, I fixed my issues. The firebasex plugin forces a new tokenID that had to be re-registered...as well, onNotificationOpen changes to onNotificationReceived in this plugin AND the iOS implementation is uses the return |
@rolinger Thanks a lot for reaching out, I really appreciate that. It looks like I did something wrong in my app for quite some time. Do I really need to re-subscribe to push-topics when the token has been refreshed ('onTokenRefresh()')? I never did that before, but that could possible explain my issues. I didn't knew that the topic subscription is based on the device token. I thought it would be handled differently internally. |
@svzi - yeah, unfortunately you do need to re-register the users token every time it changes - it would be great if Firebase recognized a users token changed and simply updated everything for you. When you register a user for a topic or a device group, the token ID is added to a managed list. if the topic does not yet exist, simply adding a user to the topic automatically creates the topic - so there isn't any new topic manage you have to do. Just subscribe and unsubscribe. I allow my users to subscribe/unsubscribe from within the app, but when the tokenID changes I have to pass the new tokenID back to my server, lookup all the users current subscriptions - then unsubscribe old and subscribe new token to those topics. Again, check out the php-fcm package I listed above on how to do this from the server. Hopefully Dave gets this added as a new plugin feature soon so we don't have to control all this from the server anymore. |
@rolinger I'll add the feature you requested (list user-specific FCM config) ASAP but it might be a week or so before I can implement it as I'm on vacation next week and my wife might throw things at me if I spend too much of it on a computer 😀 |
@dpa99c - LOL You are lucky you even get to check the computer while on vacation. My wife won't even let me bring my computer when we go on holiday. Don't worry about the feature request - go relax and enjoy your vacation. |
@rolinger Thanks a lot, that makes a lot of sense. So I modified my coding accordingly and prepared a new beta version. Will play around with. Thanks again, for making me understand this crucial part. |
I test my ionic application with https://cordova-plugin-fcm.appspot.com/
When the app is launched, everything works
When the app is not launched, i don't receive the notification, if i launch the application, the notification appears.
But i don't want this behavior, i prefer to receive the notification in the system banner.
I try with your test application and the behavior is the right one. I want the same !
I try to change content-available value, but nothing change
In IPhone Settings, i notice a difference.
So i suspect a wrong generation of my app.
I use "cordova-plugin-firebasex": "^6.0.4" with "@ionic-native/firebase-x": "^5.12.0"
In XCode, i have capabilities : "Background mode : Remote Notifications" and "Push Notifications" to true (checked by the generation, not me).
I try to compare ios platform folder between my app and the test app, it's seems to be very similar.
Any ideas ?
The log in XCode if it helps :
The text was updated successfully, but these errors were encountered: