[$250] Android - Notification - App crashes when launching app from notification
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.2.75-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Exp Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Samsung Galaxy S25 FE / Android 16 App Component: Notifications
Action Performed:
- Launch Expensify app.
- Background the app.
- Receive a notification from another user.
- Open the notification.
- Background the app.
- Receive a notification from another user.
- Kill the app.
- Open the notification.
- Might need to repeat Step 6 to 8.
Expected Result:
App will not crash.
Actual Result:
App crashes when launching app from notification. Was able to semi-reproduce once but only the New expensify part as I got the refresh app screen on the first notification.
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [ ] Windows: Chrome
- [ ] MacOS: Chrome / Safari
Screenshots/Videos
Bug7026348_1765456013071!log.txt
https://github.com/user-attachments/assets/a8526f7c-85d7-48de-80ec-5cd50dbb622b
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021999620262973499384
- Upwork Job ID: 1999620262973499384
- Last Price Increase: 2025-12-19
Issue Owner
Current Issue Owner: @yuwenmemon
Triggered auto assignment to @stephanieelliott (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Job added to Upwork: https://www.upwork.com/jobs/~021999620262973499384
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Krishna2323 (External)
Proposal
Please re-state the problem that we are trying to solve in this issue.
Android - Notification - App crashes when launching app from notification
What is the root cause of that problem?
It was introduced from this pr and commit
PushNotificationBridge is null because Headless JS can run without the native module being initialized, and the code assumes it always exists.
https://github.com/Expensify/App/blob/0c92ee767ee420c5ba4cb50a1ed9e0695c4f2077/src/libs/Notification/PushNotification/subscribeToPushNotifications.ts#L109-L111
What changes do you think we should make in order to solve the problem?
We have to ensure that finishBackgroundProcessing is called only when PushNotificationBridge exists.
const bridge = NativeModules.PushNotificationBridge;
if (bridge?.finishBackgroundProcessing) {
bridge.finishBackgroundProcessing();
}
What alternative solutions did you explore? (Optional)
@Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!
Hey @Krishna2323 can you take a look at the proposal ?
Reviewing...
There seems to be an issue when logging in with a new account. I’ll try again later today or tomorrow and report back. Thanks for waiting!
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
I'll check this again today.
I was able to reproduce the issue on my physical device using the app downloaded from the Play Store, but I wasn’t able to reproduce it on the emulator or on a physical device using the dev build.
The proposal looks promising. I just need to test the proposed changes. I’ll try again tomorrow.
@marufsharifi, let me know if you know a good way to test this. Thanks!
@Krishna2323 thanks for the update. The on-screen development error, TypeError: Cannot read property 'finishBackgroundProcessing' of null, directly causes the app to crash in production because the PushNotificationBridge native module is not being correctly loaded, resulting in a fatal unhandled exception.
https://github.com/user-attachments/assets/d600f581-653f-4d2b-8623-fdfdde07e0eb
@Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
I’ll review it again today.
@marufsharifi’s proposal looks good to me! @arosiclair, could you please have a look at the proposal since it’s related to this issue? Thanks!
🎀 👀 🎀 C+ Reviewed
Triggered auto assignment to @yuwenmemon, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@yuwenmemon @stephanieelliott @Krishna2323 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
Issue not reproducible during KI retests. (First week)
@marufsharifi @Krishna2323 please also update the type definition to make PushNotificationBridge optional.
Also use the background test here
📣 @marufsharifi You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing 📖
Thanks, I will raise the pr tomorrow morning.
@Krishna2323, pr is ready for your review. thanks.
@marufsharifi were you able to access these steps?
@arosiclair could you please share the steps, I don't have access to that repo. Thanks!
@marufsharifi were you able to access these steps?
@arosiclair could you please share the steps, I don't have access to that repo. Thanks!
@Krishna2323, no, I don't have them. I thought you had access to those and would test them. Thanks for the follow-up
Ah sorry here is the test:
Android & iOS - Background push notification update
- Log into HybridApp iOS/Android
- Switch to the new experience
- Enable push notifications
- Settings > Troubleshoot > Soft kill the app
- Send a DM to the current account
- Verify a push notification is received
- Wait 1 minute
- Enable airplane mode
- Reopen the app
- Verify
- the new message appears in the LHN
- the message appears in the chat
Note: This is a known flakey test. If this doesn't work, wait 30 minutes and try again
@Krishna2323, I don't have access to HybridApp. Do I have to test? Or you will test it. thanks