expo: Notifications don't open app since SDK45 (Android)
Summary
I upgraded a managed app from SDK44 to SDK45 and now, when a notification is received while the app is in background, touching the notification in Android doesn’t open the app as it used to with SDK44. The listener is called and executed, but the app UI is not shown.
This happens both in Expo GO Android and in the native Android app. When the same code is run in Expo GO Apple it correctly opens the app.
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
Android
SDK Version (managed workflow only)
45
Environment
expo-env-info 1.0.3 environment info: System: OS: Linux 5.17 Pop!_OS 22.04 LTS Shell: 5.1.16 - /bin/bash Binaries: Node: 16.14.2 - /usr/bin/node npm: 8.5.0 - /usr/bin/npm npmPackages: expo: ^45.0.0 => 45.0.4 react: 17.0.2 => 17.0.2 react-dom: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-web: 0.17.7 => 0.17.7 npmGlobalPackages: eas-cli: 0.52.0 expo-cli: 5.4.4 Expo Workflow: managed
Reproducible demo
This is the listener:
Notifications.addNotificationResponseReceivedListener(response => {
console.log(`received notification "${response.notification.request.content.title}"`);
});
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 9
- Comments: 39 (15 by maintainers)
Commits related to this issue
- [notifications] Fix android 12 notification trampolines (#17686) # Why originally clicking a notification to launch app in foreground, our call flow is like ``` notification pendingIntent -> bro... — committed to expo/expo by Kudo 2 years ago
- [android] backport #17686 #17751 (#17838) # Why fix the #17531 crash in expo go. # How backport #17686 #17751 to android versioned code # Test Plan android versioned expo go + sdk {43,... — committed to expo/expo by Kudo 2 years ago
- [notifications] Fix android 12 notification trampolines (#17686) originally clicking a notification to launch app in foreground, our call flow is like ``` notification pendingIntent -> broadcast rece... — committed to expo/expo by Kudo 2 years ago
- [android] backport #17686 #17751 (#17838) # Why fix the #17531 crash in expo go. # How backport #17686 #17751 to android versioned code # Test Plan android versioned expo go + sdk {43,44,45} [no... — committed to expo/expo by Kudo 2 years ago
- [notifications] Fix older notifications be overwritten issue (#17974) # Why when there are multiple notifications, the latest one will overwrite previous' intent extra data. `useLastNotificationRe... — committed to expo/expo by Kudo 2 years ago
- [notifications] Fix older notifications be overwritten issue (#17974) # Why when there are multiple notifications, the latest one will overwrite previous' intent extra data. `useLastNotificationResp... — committed to expo/expo by Kudo 2 years ago
i’m sorry that we might take longer time to release the fix. i found a regression issue from my fix. will try to find a solution and anyway, will keep the status updates here.
Nothing personal Kudo, but this order of priorities is one of the biggest hindrances of Expo for the adoption in business environment. You’re often too concentrated on delivering timely “best new things” and neglecting making existing stuff work right. Expo SDK45 was released almost 2 months ago and was completely unusable for anyone employing notifications on Android. It was probably never tested with current Android OS version before release. What’s worse, this bug and its regressions (still open) are not even mentioned in the release notes known problems, making anyone upgrading their apps from previous SDK having to find it out the hard way.
published
expo-notifications@0.15.3to address the issues. please try to upgrade expo-notifications and let us know if it still not works for you. thanks!i’m working on it. both for new expo-notifications packages as well as new expo go build. will update here once the new versions are ready.
@jnoleau good catch. to fix the trampoline issue, the fix changed much in the way to send notifications, so the issue you reported should be a regression. i’ll take a look this week. thanks!
@jnoleau we just publish
expo-notifications@0.15.4to address the issue. hopefully this one fixes all the issues. thanks!@Kudo Thanks a lot for your help with this, I’m testing your patch right now and for now it’s working perfectly 🎉 I’ll update if I see any other issue
@rrufus there is still a case i missed from push notifications. i’m working on it. hopefully we can release it soon.
Have you found any solution ? Facing the same issue
@edjiang Yes, you need to release a new binary since the changes was applied in the native code, see the PR (https://github.com/expo/expo/pull/17974/files)
@amagnolo i am apologizing for this problem and agreeing that is critical. that’s why i am trying to investigate and propose a fix during the weekend. notifications and android intents are much complicated, so we missed some test cases when released sdk 45. especially in android 12 introduced lot of breaking changes, we didn’t notice every edge cases for each expo modules. the root cause of
useLastNotificationResponseissue is actually from multiple pendingIntent and the latest one will overwrite the previous one.anyway this is the fix i’m trying to propose: https://gist.github.com/Kudo/b8d6a7e75d951fa6652fe255c2068bd0 if someone has the expertise for android to review my fix or has a chance to test it by patch-package before we landing this fix, in case i missed some edge test cases again, i am super appreciated for that. i will organize a formal pr, merge and release a fix tomorrow. thanks and apologies again.
sorry i was busy for next sdk development and didn’t get a chance to look it this week. will try to do it these two days.
I confirm that the original issue is now solved. Good job!