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
Notification on click doesn't work when device is inactive for a long time #998
Comments
Howdy,
Why are you killing background processes here? We can't guarantee the behavior if you are changing the default Android settings. The notification click is handled by starting an intent from a background process, so it won't work as expected. Hope this clarifies the issue. |
Hi @rgomezp, thank you for the response. That was to reproduce the issue, since normally during active state the notification on click works properly. I will explain the issue more over here:
This issue also happens when the device is shutdown, I turn on the device and I receive Please let me know if you need more info |
@rgomezp did you get time to check this? My most users are facing this issue |
Howdy @crushy26 , |
We're having exact same issue with our onesignal setup. But we're not using notification extender. @crushy26 did you find any workaround or more details? Do you have react-native-screens installed? If yes, try this: software-mansion/react-native-screens#17 (comment) BTW we're using react-native-onesignal@3.7.3 |
@binchik the issue will happen irrespective of the extender. But I am planning to not restore the notification and just allow notifications to be displayed when device is active ( sadly, have to do this at least to avoid such buggy UX ). I will implement this tomorrow. reference and no, I am not using react-navigation, I am using react-native-navigation by WIX. Did the above thing with react-native-screens fix the issue? and also could you let me know, what's the device you are getting this issue on? |
@crushy26 My issue was resolved when I applied the fix from react-native-screens issue I mentioned above. The device I was getting this on is Samsung Galaxy S8. It's the only device I have, haven't tested on any other. |
@binchik how do you go about testing this? what is the scenario in your case? because for me it's when device is inactive for a long time and during that time a notification is received. Later on unlocking the device the notification on click does nothing. |
@crushy26 I had the same scenario, and your reproduction steps crashed the app on launch too. I used "no background processes" option in settings just as you proposed. Before the patch it was crashing, after I applied the patch it stopped crashing. When I tried to debug with |
Okay, so you reproduced and tested, solved using the same "no background processes" option? I will do the same if that's the case because till now I thought that it is an anti-method or not a proper way to reproduce the issue. |
Is it okay to close this issue @crushy26 ? |
@rgomezp The issue persists on the example app too in the repo. I am not sure how anyone here hasn't reported this issue. OnePlus is used by majority of users all over globe. Rest apps, even from not so known developers works well with the same no background processes settings ( this is just for reproducing ), but in normal scenario on device in-active the notification clicks work for other apps as well. My 2 apps both with onesignal, giving same issues. If I can help you in anyway possible. Let me know. |
Howdy,
Most people never even turn on their developer options let alone limit their background processes. It is expected that doing this may have residual side effects on certain device environments. If you would like to implement the "patch" as suggested by binchik above, we encourage you to do so. Please let us know if you have further questions. |
@rgomezp any inputs or help? |
Hello, Perhaps I am missing something. |
Edit: The issue still persists When the device is idle for a long time and notification is received, on unlocking device and clicking notification nothing happens. I am attaching a screen recording for the same and the error I filtered from ADB logcat. Recording link: ADB logcat filtered error:
This issue persists in the example folder as well. @rgomezp if you need any more info let me know. |
Hey @rgomezp can you please look into above comment. I upgraded to 4.0 beta as well to check, but the issue still exists. This is an critical issue for my users running on oneplus devices and I really don't want to switch library now. Please help. Thank you. |
@crushy26 and @binchik are you both able to reproduce this on a blank app with only OneSignal active? What other dependencies are you using within the app besides OneSignal? |
Hi @jfishman1 Checked on the example app again, the issue persists for oneplus devices running android 10 ( might persist on other manufacturers as well, but I have tested on oneplus 8, 7T, 3, 3T ) To reproduce:
Let me know if you need anything else. |
The problem seems to be with alarm manager not been recognized. Here is the piece from the system log:
Here are some solutions for a similar problem, |
Howdy, |
Hi @rgomezp I would like to add to the above. Here is the line from logcat: ActivityManager: Killing 13935:com.hog.debug/u0a570 (adj 905): empty # 31 |
Howdy @crushy26 , Thanks for your patience. |
@rgomezp Hey, thanks for the support. It's strange that even though there are OS-level restrictions like battery optimize.., many new android apps are able to execute this flawlessly without any extra steps to be taken by the user like turn off battery optimization, etc. which is what bugs me (Also, Below apps won't be whitelisted by the vendor for sure since it is very recent and small scale apps for now, in comparison to Facebook, etc which might be whitelisted by vendors) not sure if both the apps are available In your country to test out though. |
I recently implemented Freshchat's react-native SDK and it has the notification functionality to let users know a new message has been received. Their SDK is working fine and the above issue doesn't persist there. Compared both onesignal and freshchat's notification side by side, by sending notifications to the same device. Onesignal notification didn't enter the app and freshchat's did under same conditions Please check the sdk here |
@crushy26 Thanks for the details and trying out the beta so far, I have some follow up questions. Question 1 - Are you only seeing this issue on OnePlus devices? Question 2 - On OnePlus devices specifically, did this problem only start happening when updating to Android 10 on them? Question 3 - After tapping on the notification and observing the issue of the app not opening, if you send a new notification is it still shown? Comment 1 - OneSignal's Notification open process does not use an AlarmManager Please responded to the questions you can above and we can look into this more in-depth after this. |
Answering your above questions,
Tested the latest beta SDK today, the issue persists there too. |
Thanks for the details. Only notification taps not opening the app is very odd since new notifications are still received, which means the app hasn't been force killed by the device. Let us know if you see this issue on any other devices, emulator, or Android versions so we can narrow down the issue. |
Hi @jkasten2, I am pasting ADB logs before and after notification click for both freshchat's notification which I have integrated and normal notification from onesignal (it takes 10 minutes or so for the activity to be killed, before that everything works fine) FreshChat's notification click I have highlighted bold. Just above it is onesignal's notification click. Also, below you can see the activity is being killed, which is the cause for onesignal's issue. Before that everything works fine. The logs will also help you figure out what exactly happened after the activity was killed and steps taken by freshchat to make it work. PS: Freshchat is a customer support service, which sends a notification to the user once our staff replies to them via dashboard
|
Howdy, |
@crushy26 We fixed a 4.x.x regression issue with notification opens not starting the app if it tried to cold it in react-native-onesignal 4.0.4. We also made an improvement to resume the app just like an Android Launcher does if the app is already running in the background. It involved changing how the Intent is created which could result in indirectly fixing cold start issues too. So in summary I suspect the following:
I did test OneSignal-Android-SDK 4.2.0 on a OnePlus 6T (Model A6013) with OxygenOS 10.3.8 (Android 10) (Build number A6013_34_210114) and was not able to reproduce any open issues.
@crushy26 Could you try the new version and let us know if you are still seeing the issue? |
Hey @jkasten2 Thanks for your time. I checked with 4.0.4 and tried all the cases possible. For now, everything seems to be working! I will confirm in the next 3 days once it is tested thoroughly in Beta with our users. |
That's great to hear @crushy26 Let us know if you would like to reopen the issue |
Description:
Note: notification is received in all cases and on click works in all cases when the device is active.
This issue is critical and occurs when the device is in standby mode for a long time or if the notification is received when the device is shutdown & you restart:
The notification when clicked doesn't open the app, in fact, nothing happens.
Environment
react-native: 0.62.0
Device: Oneplus 3
Android version: 9
Steps to Reproduce Issue:
This issue usually won't occur when the device is active. To reproduce you need to change the device settings & also make sure the app is killed.
Anything else:
Note: I am using notification extender service to change the layout of the notification.
Also, I tried pending Intent with reference to this comment
Here's the code:
The text was updated successfully, but these errors were encountered: