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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expo Push Notifications not received when app is closed [SDK 38.0.9] #9748
Comments
The same issue happens to my Huawei P30 Pro, notifications failed to arrive intermittently. My app.json
|
@amber-pli is this dependant on app activity status (closed, background, foreground)? Also, is it working on other android devices? Everything is perfect on my iOS test device and android device provided the app is in the background or foreground. When on my android device and the app is closed the notification doesn't arrive 100% of the time. |
@JamieS1211 Mostly the same behaviour as yours (iOS iPhone SE and Android Huawei P30 Pro). With the android device, when the app is closed/killed the notification doesn't arrive 100% of the time. In addition: when my app is in the foreground on android device, notification never arrive. |
Does your notification on android arrive when app is in the background and do you use "nextNotificationAPI"? I had an issue because I forgot to add the code for the foreground listener. Details here: https://docs.expo.io/versions/latest/sdk/notifications/#handling-incoming-notifications-when-the-app-is |
@JamieS1211 thanks I think I have missed |
@amber-pli Glad I could help. Now I can welcome you to the club of notifications being fine except on android devices when the app is closed haha |
Refer to #5058 |
@JamieS1211 Have you tried SKD38 with legacy notification? |
@amber-pli Thanks for that other bug report, was an interesting read. I am indeed testing on a OnePlus device and suggested by the post. I have however just double checked and disabled "battery optimisation" for my test app and still no luck (also restarted the phone). I haven't tried SDK38 with legacy notifications. I was having a large amount of problems before the SDK38 update with notifications, and actually had a draft bug report when I (ironically) got a google notification saying SDK 38 was released. As such I scrapped my bug report and adopted SDK38. |
Having done more reading on the topic and gone through my settings for about 15 minutes I found a setting under "Settings" -> "System" -> "Recent app management" (OnePlus 3 device). By changing this settings to "Normal clear" I was able to receive notifications with the app closed. I guess the logical next steps should be this:
My personal thoughts on step 2
|
@JamieS1211 I think since the Android OS tells the user that this setting may result in notifications not being delivered, if they select this, it's most likely because they are OK with notifications not being delivered (or don't want them delivered, in which case it would be unwise to try and work around that). I'm not really sure what the task that runs every 60 seconds would be able to do about this setting, but if you'd like to try something like that out, I think Closing this since it's not a bug with the Expo SDK |
Hi @cruzach thanks for your message and link to "expo-task-manager", I will try and come up with a solution of my own here (others have suggested internal secondary receipts - probably a better idea). In light of the fact many users configure their phone settings months to years before they may install any given app, and across different devices this could even be the default, I think it is at least worth mentioning it in the notification docs that this type of issue may occur. While your dead on that this isn't an expo bug (and having looked around people have issues with this all the time outside of expo), I think any message that could potentially save developers time and frustration, and by extend you guys from responding to tickets such as this, is a good thing. I don't think I am by any means most qualified to write such a warning / info message for the docs but I will have a crack and make a PR to the docs. Worst case scenario someone comes up with better phrasing! |
Added warning / information message about possible failure of message delivery with android devices dependant on aggressive battery optimisation settings from certain device manufacturers. Related issues: expo#9748 expo#5058 Informational articles: https://www.freecodecamp.org/news/why-your-push-notifications-never-see-the-light-of-day-3fa297520793/ https://hackernoon.com/notifications-in-android-are-horribly-broken-b8dbec63f48a
* Warning for possible android delivery failures Added warning / information message about possible failure of message delivery with android devices dependant on aggressive battery optimisation settings from certain device manufacturers. Related issues: #9748 #5058 Informational articles: https://www.freecodecamp.org/news/why-your-push-notifications-never-see-the-light-of-day-3fa297520793/ https://hackernoon.com/notifications-in-android-are-horribly-broken-b8dbec63f48a * Update docs/pages/push-notifications/receiving-notifications.md Co-authored-by: JamieS1211 <jamieshepherd1211@gmail.com> Co-authored-by: Charlie Cruzan <35579283+cruzach@users.noreply.github.com>
@JamieS1211 I thinks #9037 is related to our issue and fixed in #9287, which will be available in SDK 39 |
@amber-pli those are interesting. I uave not observed that behaviour myself but perhaps now some notifications are coming through I will get thos. Will keep my eyes out |
馃悰 Bug Report
Summary of Issue
When sending push notifications (managed workflow) to android devices (running a built standalone app), using Expo push notification service, notifications are not delivered when app is closed. These notifications are delivered when the app is in the foreground or background .
Environment - output of
expo diagnostics
& the platform(s) you're targetingExpo CLI 3.24.0 environment info:
System:
OS: Windows 10 10.0.18362
Binaries:
Node: 12.16.0 - C:\Program Files\nodejs\node.EXE
npm: 6.13.7 - C:\Program Files\nodejs\npm.CMD
npmPackages:
expo: 38.0.9 => 38.0.9
react: 16.11.0 => 16.11.0
react-dom: 16.11.0 => 16.11.0
react-native: https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz => 0.62.2
Reproducible Demo
app - https://github.com/JamieS1211/Expo-Notification-bug-app
Steps to Reproduce
expo ba
Expected Behavior vs Actual Behavior
I would expect a the notification to be received.
The text was updated successfully, but these errors were encountered: