-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
iOS: Push notifications are shown when in foreground #817
Comments
I was relieved when they started working as I was not able to get this plugin to work with cordova-plugin-local-notifications; however, you are right that the notifications should not be shown as it was before. |
Also getting this issue :( |
@maitscha it seems that you have some idea on a fix. Can you fork the repo, make the proposed change and create a pull request? That would also allow others to test the change. |
Made a pull request: #835 |
@maitscha, looking at the comments on #835 it looks like this bug isn't fixed by that PR. Any other ideas for how to prevent the notifications showing on iOS when the app is in the foreground? |
…ation-foreground Hide iOS push notifications when app is in foreground
Any updates on this? Still not working properly |
We are having the same issue - is there any progress made on this? |
I got it working. |
same issue here. @cremfert what exactly did you change to make it work? |
Our team has faced with this bug too. Did someone handle that? |
if i rewrite AppDelegate+FirebasePlugin.m: push notifications not appear, no matter if in foreground or in background. Is this plugin outdated? There are no updates in months. EDIT: solution: apache/cordova-ios#407 |
Someone has a solution? |
I have a fix for this bug NSNumber *background = self.applicationInBackground;
if([background boolValue]) {
completionHandler(UNNotificationPresentationOptionAlert);
} else {
completionHandler(UNNotificationPresentationOptionNone);
} ** edit ** This should replace completionHandler(UNNotificationPresentationOptionAlert); on line 183 of the AppDelegate+FirebasePlugin.m |
@Farmertjes where did u add this code? |
@kamilo81 in the AppDelegate+FirebasePlugin.m file at line 183 it seems to me |
@Farmertjes when I apply your solution, notifications are always displayed when the app is active. In addition, when the app is not open (no process in background or foreground) notifications are not processed. Could you give a little more detail on what you did to make it work? |
I changed In both files in line 183, I replaced Now, it behaves like expected (no notification in foreground, only in background). |
@cremfert there is no effect after these changes :'( |
It works for me |
@kamilo81 Do you have a special application configuration? This is the version 2.0.5 you use? |
No. Its standard configuration. 2.0.5 it is |
The notification is not intercepted by this plugins! |
Not sure, why this happens - I just installed the plugin and changed the mentioned files. After a new build, everything works for me. I'm using 2.0.5 as well. Push messages are received and shown when the app is in the background, but not when in foreground. In the latter case, only the callback in the is called with the data of the push message. EDIT: Maybe it's due to the conflict - I'm not using any background mode plugins (like the one mentioned in your post @papattes) |
This solved the issue for me as well. Is there any reason the Firebase team has not addressed this yet? |
On iOS Push notifications are shown although the app is in foreground. This bug was introduced in the commit 06a8b2d.
As per Apple developer documentation: https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate
So the completion handler should be called with
completionHandler(UNNotificationPresentationOptionNone);
, which doesn't show the Push notification anymore when the app is in foreground.I think the default behavior of this plugin should be not to show Push notification when in foreground.
The text was updated successfully, but these errors were encountered: