-
Notifications
You must be signed in to change notification settings - Fork 374
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
Need React Native OneSignal background listener for Android & IOS #1154
Comments
@rgomezp @gdeglin @leemunroe @keithnoguchi @forki |
Facing the same issue on IOS, Please me out I'm stuck last two days :( |
Howdy, I'll mark this as a feature request. Thanks for bringing this up. In the meantime you will have to use our service extension functionality: https://documentation.onesignal.com/docs/service-extensions Be prepared to write some native code! Cheers |
@rgomezp yes I've tried to integrate service entension but it never triggers. |
I also did try to integrate service extension, though it works in development I am having problem with the release APK all error are pointing to the service extension. It would be nice to have it included in the package instead of creating a new class path. |
Yes - this feature is essential for my application. AWS has this feature but one signal seems like a better service. Would rather not have to go back to AWS. |
Thank you for your patience, we will begin to think about paths towards building this functionality. |
Howdy y'all, Cheers |
In our app we do two things with our receive listener
|
@rgomezp we need a background notification listener to update state and UI. Because not every user tabs the notification from the top. |
@rgomezp Just made the switch to v4 and now realizing this issue with not being able to run code when a non-silent notification is received while app is in the background. The solution of using the silent background notifications does not make sense in the context of a notification that needs to display to the user. An example and our use case is when a user receives a new message notification the message is added to the locally stored messages as soon as the notification is received as an optimistic update so that if a user has notifications on the new messages are immediately available for viewing. I do not see a possible way to do this in v4 and this behavior was working just fine in v3 with the onReceived listener. |
Howdy, |
We need same "received" handler / observer in v4 as it was in v3. |
Any update about this feature? |
saw your comment, any news about the android feature? |
This comment has been minimized.
This comment has been minimized.
Howdy, |
@rgomezp sir how much we have to wait for this update??? |
We used to have OneSignal v3 in our project and we depended on the ability to react to background notifications. @rgomezp any chance you'll bring this ability back? |
Did anyone find a way to handle notification in react native app while the app is in the background or killed state? |
Since january this it's reported..?... at least would you add a example of the Android Notification Service Extension? to address this issue? im using react native and this a big stopper to my customer. |
Any updates???? |
Use headless js, FirebaseMessagingService, and foreground services in android. You have to write some native code. |
I have the same issue with the |
Same in 4.3.1. I need update my bottom tab even if notification received in background, but in 4.3.1. i cant do this. So please provide some background handler for this |
Any updates? |
Hello Rodrigo, how long do companies should pay for service and not get the most out of it? this issue has been for quite a long time. can we please address this issue and solve it as soon as possible? quite long time we are waiting for this fix. |
Hi everyone, for React Native to handle notification payloads received while the app is in the background, you will need to implement a Native Module. We have a guide on this here: https://documentation.onesignal.com/docs/rn-android-native-module-setup-for-notification-service-extension The native module will then trigger the service extension which can pass the data to the RN app. The OneSignal SDK has never had the ability to handle notification received events while the app is in the background. You will need to implement the Native Module to handle this. We will take this into consideration as a Feature Request. Thank you. |
Thank for the help and the link. I just want to mention that I do not agree with you when you say that the SDK has neved had the ability to handle notification received while the app is in the background. On our side with stick with version 3 of the sdk because it works with this version but not with version 4. For me it's not really a feature request but a regression between v3 and v4. |
@jfishman1 I've implemented the service extension and tested notification display in fg, bg and killed state.
Can I know why in killed state, the notification still display? Does it not trigger the service extension? I understand that when app is killed, RN module will not be initialized so couldn't pass the notification data to App.js. I supposed the notification will not be displayed. I'm trying to find a workaround to handle notification if user manually cleared app data without logging out, causing notification still be sent to the device. Update: |
As @scesbron, @zuhairnaqi and others have said, we have similar use-cases:
So, the func to trigger a callback to our code, so we can send an ACK, is very important for us. |
any update? |
Just to notice that I am now stucked. I was keeping the v3 version because of this problem but I had to update my app to react-native 0.68 and add support for Android 12 (sdk31) but now I face another bug that apparently can only be solved by updating to the latest version: https://github.com/OneSignal/react-native-onesignal/releases/tag/4.3.2 |
Since 29 Jan 2021, still no update for this feature. |
When can we expect an update for this ? 😞 |
Did this work ? Tried this approach, but NotificationEvent in front end never gets trigger. Any idea ? |
Hi, Anyone find any solution for this ? |
Interested in this feature, does anyone have an update or got the native part working? |
not work what so why. |
The year is 2024 and i have the same problem here, any workaround ? |
Everywhere i look. Some people keep saying "you will have to write Native code", and sure i understand this. Is there somewhere an example or guide on how/what to write? and the guide mentioned by @jfishman1 is no longer available EDIT: I have found the following NPM package (mentioned by https://www.npmjs.com/package/react-native-push-notification which itself is mentioned in the React Native docs) https://www.npmjs.com/package/@react-native-community/push-notification-ios and i can confirm that this works for receiving silent background notifications sent by OneSignal (either by OneSignal UI or the node API), though i have only tried for iOS. |
For android the general package may work only if they are using firebase messaging. |
Description:
I want background listener to update status, just like firebase provide us messages().setBackgroundMessageHandler.
One signal version
"react-native-onesignal": "^4.0.3",
Environment Dev
Steps to Reproduce Issue:
The text was updated successfully, but these errors were encountered: