-
Notifications
You must be signed in to change notification settings - Fork 198
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
[Bug]: iOS - App in foreground: no Event fired, no Push displayed #943
Comments
I want to note, that the "foregroundWillDisplay" callback only gets executed once... so its super hard to display multiple e.g. alerts / toasts on your own in a single session. |
I can confirm the behavior. Unfortunately, in foreground mode there is no option to execute another reaction when a push comes. |
Hi @louis123562, thanks for reporting. I am clarifying the information you shared.
The logs you shared look like Hi @dszczudlo, is there any additional information you can share to reproduce the issue? |
Hi,
For me the message was never shown if the app is in foreground.
When the event „foregroundWillDisplay“ is registered, the code in the callback is only executed for the first push message. After this it is not working. I have tried it on multiple devices.
My code inside the listener is:
event.preventDefault();
console.log(event.getNotification().body);
event.getNotification().display();
I can only see the body of the first message.
|
Hello @nan-li, below my answers to your clarification potins. Answer to 1.With
I do not see anything on my iPad or on my iPhone that looks like a notification and there is no notification sound. Answer to 2.With only
When sending another push via API, i get this output:
And a few seconds later:
Answer to 3.Thats what i mean with "my callback only gets executed once". This ouput
repeats on every following push i send via API. Only after a fresh app start, the first time a push hits the device, the callback gets executed. After that one - only the same garbage and NO callback execution. Calling It would be very great if we can fix this issue; otherwise i will be forced to switch to another provider. |
@louis123562 "ios": { But unfortunately the problem you described with the eventListender "foregroundWillDisplay" still exists. |
Hi all, thanks for your responses, I will investigate the behavior of As for notifications not displaying in the foreground, that's right, I do recall now there was an issue with Capacitor and needing to override So now, the only problem is with the |
Hi @nan-li , for me it would be great if the eventListener foregroundWillDisplay would work. |
Hey @nan-li, i can confirm that, with
in capacitor.config AND the callback for When i register the callback for the So yeah, your assumption, that the only problem is |
Thanks @louis123562 for the feedback, we updated our Capacitor setup docs with a callout about I will continue to investigate and reproduce the foreground display issue you are both seeing. |
Dear all, |
Hi I also have the problem, that the |
Hello, |
Hi everyone, thanks for your continued comments. |
Hi everyone, thank you for your patience. Please update and reach out if you are still seeing any issues. Thank you! |
Mmhm... i just tested 5.0.5 and i dont see any difference in the behaviour. I also still see
but in my code, i do call it:
|
Hi, Weird, for me after updating to 5.0.5 everything works as expected:
That being said, I don't see anything wrong with your code though. |
yeah, now it works for me, too :) I removed my node_modules, package.json.lock, and the iOS platform folder, reinstalled node modules and added the platform again. |
What happened?
I migrated from Cordova to Capacitor and updated this plugin to the version ^5.0.3
On iOS, i do get Push Notifications only, when the App is not in focus or my device (iphone, ipad) is locked.
I tried to catch the event "foregroundWillDisplay" when the App is opened, but that does not work great...
It turns out, that the event does get fired, but displaying the notification with
event.notification.display()
from the examples does not work.code fragments
initialize OneSignal Plugin
Add Event Listeners
Initialize in app.component.ts
JSON for the API Call to trigger Push
When i send a push message via API, the event does get fired, but even here, no "banner" or "toast" is displayed. Instead, i get the following in console:
And after 25 seconds i get:
In system settings, the proper settings are set to receive push and show banners.
Steps to reproduce?
What did you expect to happen?
I do expect when the App is in foreground, either with the eventListener for "foregroundWillDisplay" or without, there should be a notification shown to the user. When i was using Cordova, the push notification was always shown, independent in what state the App was.
OneSignal Cordova SDK version
^5.0.3
Which platform(s) are affected?
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: