-
Notifications
You must be signed in to change notification settings - Fork 376
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
onOpened/onReceived events do not firing on android #583
Comments
On IOS it's working perfect. Unfortunately i can't provide logs from android logcat, because i don't have a real device. I was testing on my far away friend's device due TeamViewer. I also tried to |
Hi @Ble3k , we have been quite busy working on a new Flutter SDK recently and haven't had time to investigate your issue yet, however I will investigate tomorrow and will get back to you shortly, apologies for the delay! |
Hi, Just wanted to say I see the same behavior on 3.2.5 on a dev device. Weird because I haven't changed anything recently and I'm pretty sure it worked some days ago, as my focused pushs are displayed as in-app toasts I remember having tested these and it was working. I won't investigate further because we decided to move to normal push notifications even when app is focused |
@Nightsd01 Thx, will wait for your investigation. |
On Android facing delay in receiving notifications, tested on my android phone and received notification after 30-40 mins, multiple times tested |
Any update on this? I am having the same issue on Android device (Samsung Galaxy S7). None of the onOpened or onReceived events are being fired, however, the notification is being received. We need to be able to navigate the user to a specific screen when the onOpened event is fired. |
Does anyone have problem with events (received, opened) not being fired after reload react native android app by double pressing R, or using react-native-restart package. |
@ackosumane I actually use Expo and And you are right:
@Nightsd01 So it looks like OneSignal RN Android integration currently does not support app reloads very well. It is not as impactful as I thought as most of the time the user will not reload the app, but there are production cases in which we want the user to reload the app (OverTheAir updates like Expo/CodePush, or user logout?). In such cases it would be great that after a reload the pushes are not broken ;) |
@Nightsd01 Hi, any updates ? |
Hello there, I also face the same problem.Any solutions for this ??? |
As an update on this issue: we plan to fix this in the next update! |
@Nightsd01 Any date ? Is there a branch we can fork with the fix ? |
@sofianegargouri Here's the PR: #592 We'll be releasing an update either tomorrow or the day after. |
thanks @Nightsd01, this issue can be closed I guess can you publish a new npm release with the fix please? |
For anyone who stuck with this issue, the code from master is working well now. Just run the following: npm install git+https://github.com/geektimecoil/react-native-onesignal\#master --save |
@eabuslaiman30 Still facing an issue. I am using git+https://github.com/geektimecoil/react-native-onesignal\#master as you mentioned above. Still none of events is triggered in android. Anyone can suggest which latest version is stable? Previously I was using 3.0.5 version which was working fine except app is killed and notification is not received in android 8.0 (Oreo). To fix that issue I update to latest version and i'm getting this error . |
for android RN restart issue: OneSignal#583
@eabuslaiman30 @Nightsd01 I also tried and like @shahchaitanya I still face the issue. I have made a PR that seems to fix the listeners not subscribing again: #593 @shahchaitanya you can edit the local project Java code with this tiny change and this should solve your problem temporarily. |
Hey @slorber Your solution trigger onOpened and onReceived method. But onIds event is not triggered yet? Did you check onIds event is triggered or not in your code? I was thinking stick to react-native-onesignal version 3.0.5 till latest version will become stable. |
I just tested and all 3 callbacks fire on app restart for me, starting with onIds. Even if onIds didn't fire it wouldn't be a big deal for me as the ids are unlikely to change across restarts and they have already been sent to my backend. |
@slorber For me it's big deal if onIds didn't fire when restarting an app. I store idToken in local storage and backend also. On signout i removed it from backend And Somehow if user clear local storage, then how can i get idToken of a user if onIds didn't fire every time. In previous version until 3.2.0 (Major Update) , onIds is triggered every time while restarting an app. |
Hey guys @slorber @shahchaitanya. Let me copy some of my implementation code, maybe it will help you (I needed to add some lines of code that weren't required with a previous version).
For example, I was not using the "init" function in previous versions since the initialization apparently was being done from the Java code. Also, i'm using |
I'm also using init and configure and remember there was an issue with ids not firing when not calling configure OneSignal.init(OneSignalAppId, OneSignalSettings);
OneSignal.addEventListener('received', onReceived);
OneSignal.addEventListener('opened', onOpened);
OneSignal.addEventListener('ids', onIds);
// Quickfix for ids event not firing!
// See https://github.com/geektimecoil/react-native-onesignal/issues/200#issuecomment-288579373
OneSignal.configure();
OneSignal.inFocusDisplaying(inFocusDisplaying);
OneSignal.setSubscription(true);
OneSignal.syncHashedEmail(email);
OneSignal.sendTags(tags); |
@slorber @eabuslaiman30 Now it's working Fine. I missed to add OneSignal.configure(). Previously i didn't need it to trigger onIds listener. Hey @slorber now i don't need to add that patch that you mentioned above. @eabuslaiman30 solution is working absolutely fine. |
Perfect @shahchaitanya, I'm glad it worked! |
We will be coming out with an official release soon including this fix. I recently fixed a somewhat significant issue with the Android SDK, so I am waiting for that PR to get reviewed before I release an official react-native update. Thanks for your patience everyone! In the mean time you can simply use master |
@shahchaitanya the This is confusing legacy code, I intend to refactor it in the next major release to be a lot more intuitive. You can force them to fire by calling |
Issue should now be fixed in 3.2.6 (along with several other things). Thanks for your patience everyone! |
Hi! I'm still getting this issue on Android (not fully checked iOS).
I am on the 3.2.6 release and my event listener set up is...
|
@joefazz I am not able to reproduce your issue, can you try running Does the issue happen 100% of the time for you? Are you able to reproduce this issue in our demo project? |
It does happen 100% of the time and still occured after removing and readding. I will try to reproduce sometime later today and I'll edit this comment with my findings. I don't know how relevant it is but in the project I'm working on we were on version 3.0.9 and upgraded all the way to 3.2.6. I ran react-native unlink and then relinked, upgraded iOS manually and removed all the native initialisation to use the OneSignal.init() method. EDIT: Not sure what happened but it's working 100% of the time on Android now thanks for your help sorry to comment on a closed issue 😅 |
If anyone sees this issue again in 3.2.6 or higher, please feel free to open a new issue. @joefazz Glad to hear it! I fixed the issue that caused the initial problem but it's entirely possible there's some sort of race condition going on. If you see this problem again please feel free to open a new issue |
In my app the new version fix my issues and I don't see the behavior reported by @joefazz |
Hi all, I have the same issue only android - 8 verison |
I'm having same problem. opened wont call when app is background is there any fix |
@kostiantyn-solianyk @shrolr , The tradition events are being deprecated in the coming major release (now in Beta). I recommend migrating to the beta and attempting to reproduce the issue. If the issue persists, please do let us know by opening a new issue. Cheers |
Description:
Hi everybody. I'm having troubles with onOpened/onReceived events on android. Behavior is different on emulator and on a real device, but exact push message is delivered in both cases.
On emulator:
On a real device:
Environment
Steps to Reproduce Issue:
Can't provide steps to reproduce due to my company's policy of confidence.
Anything else:
android/build.gradle
android/app/build.gradle
android/app/src/main/java/com/binomysteryshopper/MainApplication.java
AndroidManifest.xml
my OneSignal init
The text was updated successfully, but these errors were encountered: