OneSignal-Cordova-SDK icon indicating copy to clipboard operation
OneSignal-Cordova-SDK copied to clipboard

[question]: Dublicate foregroundWillDisplay

Open ByDodo opened this issue 1 year ago • 7 comments

How can we help?

How can we help? I am using the event listeners as described in the setup guide, but when I receive a notification, the events fire more than 10 times. How can I fix this?

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

ByDodo avatar Aug 09 '24 12:08 ByDodo

Hello @ByDodo thanks for reaching out! We're looking into this. In the meantime, are you able to share the debug log from your device reproducing this? Thanks!

jennantilla avatar Aug 15 '24 20:08 jennantilla

Same issue, using foregroundWillDisplay and testing one push notification triggers the event multitple times. However, the amount of triggeres seems to vary, it can be 1 but it can be like 20.

hen68 avatar Nov 01 '24 21:11 hen68

This is probably caused by #1015 as well.

@hen68: Can you confirm that this only affects Android?

theigl avatar Nov 02 '24 08:11 theigl

@theigl I was testing it on iOS and having this issue, will have a look at Android as well

hen68 avatar Nov 02 '24 09:11 hen68

If it happens on iOS, then it must be a different issue. Thanks for checking.

theigl avatar Nov 02 '24 09:11 theigl

removeEventListener does not remove the event lisener the way you would expect, as such, if you are using react and you hope to do cleanup in your useEffect, it wont happen and it will just keep readding addEventListener. So each time you save your stuff it will add another addEventListener, as a solution i just reload the app to have a clean state when testing foregroundWillDisplay.

csotiMatyas avatar Feb 06 '25 07:02 csotiMatyas

Hi all, we made a fix related to adding listeners in Release 5.2.13.

Please check out the new versions, and let us know if your issue is resolved or not resolved by those changes.

nan-li avatar Sep 12 '25 05:09 nan-li