-
Notifications
You must be signed in to change notification settings - Fork 244
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
Query Android 13 onBackgroundEvent vs getInitialNotification #870
Comments
Hi! You can use Platform.Version to avoid double handling |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
We noticed some android 12 or 13 devices can trigger |
Same situation, any ideas? I saw for sure it is not working for me on android 13 Samsung's devices ie Galaxy S23. |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
Indeed - hopefully I'm able to reward your faith in this repo with some solid maintenance, it's a struggle but I am here and watching |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Not stale |
I was wondering about this; after Android 12, onBackgroundEvent won't receive events when app was killed. I don't know why, but it does. so let's just say answer first: you should filter onBackgroundEvent and use getInitialNotification. (note: getInitialNotification returns same data when you do hot-reload.) this comment (#616 (comment)) says onForegroundEvent, but I'm not sure It's working. in my device, I can only receive data from getInitialNotification. really confusing.
check #621 (comment). If some devices can fire event, but some others not, you can suspect reactContext might be null. |
Hi @Eclipses-Saros, thanks for the heads up. The first comment you shared is about iOS. On android, when you launch the app (app was closed), the We run the same app on different devices, but they have different behaviours. Is it possible that reactContext is null on some devices but not on others? |
okay, I'll make the answer more clearly: "reactContext is null" problem is you cannot receive any notification events whether foreground or background. because reactContext is null, native library cannot emit events and nothing happened at all. however, I'm not sure notification from killed (exited) status also emit background event. and as far as I know, getting notification data when app was killed is a different.
I remember notifee fires onBackground event when you press the notification at the app was closed; (https://notifee.app/react-native/docs/events#background-events) but looks like now it's no longer do it. (I'm not sure, but at least my android devices won't send any background events when it's killed) If you want to receive data from onBackground event but some devices won't do this, reactContext might be a problem. you should check context exist first. also, double-check permission and policy settings to make sure it's working. If not (just want to receive notification data on boot), try to use notifee.getInitialNotification(). it should be there. I'm currently check all initial notifications from firebase messaging and notifee. const firebaseNotification = await messaging().getInitialNotification();
const notifeeNotification = await notifee.getInitialNotification(); (if there is NO data exists, then that is an another problem)
well... yes. I have two Android devices, which versions are 12 and 14. both are have same problem: reactContext is null. but once I tested someone's device, there is no problem. weird. |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
I don't believe this is stale but I've not had a chance to check the latest Notifee releases to see if behaviour has changed |
This may be fixed in v9.1.2 here - there was definitely a problem with new architecture if it was in use, and it would not work until v9.1.2 just now |
We (Doris, Yupeng and I) are on old architecture still but we'll give it a retest on 9.1.2 when we're able to do the upgrade. |
What I expect is
EDIT: So the |
I have an android 10 device and an android 13 device.
When the app is exited on the android 10 device and a notification is pressed, onBackgroundEvent handles the notification correctly.
However, on the android 13 device, onBackgroundEvent doesn't pick up the notification. Only getInitialNotification works.
If I implement both there are issues on android 10 as the notification is being handled twice.
Is this how notifee is supposed to be working? The documentation makes it appear that getInitialNotification should not be required in my case.
The text was updated successfully, but these errors were encountered: