notifee: onForegroundEvent triggered with app in background/closed
Hi!
The following behaviour is happening to me: I call displayNotification
method, with my app in foreground, the notification is displayed but I don’t press it and instead I send the app to background. Then, I go to the notification center and press the notification. As per the documentation, I expected an onBackgroundEvent
to be triggered, but instead I am getting an onForegroundEvent
. This happens even if I completely close the app and only then press the notification.
I can reproduce this behaviour both in my app and on @mikehardy 's demo project, only in iOS. Android seems to be triggering the correct events.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 15 (6 by maintainers)
I have the same problem
This is quite a common issue I think with apple and notifications but I can see how we can resolve this. As the ‘PRESS’ event is triggered, the app transitions from an inactive -> active, we don’t get a heads up that it’s from the background, but we can treat it like it is.
If the app is already in the foreground, the state will be active.
Alpha release is now published
yarn add @notifee/react-native@alpha
to install version 1.11.0-alpha.0Hi there! Thanks for checking with the demo script as well, gives me an immediate repro 😃. I have a separate issue I’m investigating right now with regard to events triggering invertase/react-native-notifee#233 so I’m in reproduction mode on events right now, hopefully will have more information today