notifee
notifee copied to clipboard
PRESS event is not detected in onBackgroundEvent
I'm using notifee to send local notification from inside the app and want to be able to detect that user pressed on notification.
I thought I will be able to check for PRESS event type inside onBackgroundEvent, however I noticed that onBackgroundEvent is triggered only once with DELIVERED event type, then the app is opened, and only then I can detect PRESS event type inside onForegroundEvent that is triggered once the app is opened.
my questions are -
- Is this the expected behaviour ?
- shouldn't onBackgroundEvent be able to use also to detect PRESS event ?
- Is it possible that onBackgroundEvent will be triggered multiple times, first with DELIVERED, then with PRESS ?
- If not, how else it can detect PRESS if it was already triggered with DELIVERED ?
I found the following "hint" that implies I should use onForegroundEvent but I didn't really understand why...
I'm using only notifee without Firebase, most examples & issues I saw involve also Firebase.
In iOS I at least get both onBackgroundEvent & onForegroundEvent triggered, in Android I'm seeing only onBackgroundEvent triggered once with DELIVERED and don't see onForegroundEvent triggered at all.
I thought this could be related to this issue, however I'm using RN < 0.73:
"react-native": "0.72.10" "@notifee/react-native": "^7.8.2",
Just to clarify - I want to detect when user pressed on notification itself, I don't have any buttons on the notification.