Re-apply Fix GPS crashes in the background on Android#92171
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a95bc88ce
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return START_NOT_STICKY | ||
| } | ||
|
|
||
| return START_STICKY |
There was a problem hiding this comment.
Preserve the deep link when Android restarts the GPS service
If Android kills this foreground service while a trip is still active, returning START_STICKY allows the system to recreate it later with a null intent. In that restart path lines 21-23 fall back to default text and deepLink is null, so the rebuilt ongoing GPS notification has no ContentIntent and tapping it no longer opens the in-progress GPS screen. Returning START_REDELIVER_INTENT here or persisting the last deep link would keep the notification actionable after the exact low-memory/service-restart scenario this change is meant to handle.
Useful? React with 👍 / 👎.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
📲 Install BuildsAndroid
|
|
@mountiny looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
|
This is straight reapplication of the existing code that was tested before. Seems like Ai reviewer was stuck and that led to the Emergency label, not Emergency so removing the label |
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.3.90-0 🚀
Bundle Size Analysis (Sentry): |
Help site review — no changes requiredI reviewed the changes in this PR against the help site files under Why: This PR is an Android-only implementation/reliability change. It replaces the Airship LiveUpdate-based GPS notification with a native Android foreground service (
The existing article Distance-Expenses.md already documents this behavior accurately:
Since this is an under-the-hood fix with no change to user-facing copy, behavior, or UI, I did not create a draft help site PR. If you'd like a docs update anyway (or you think a user-facing detail did change), let me know and I'll draft one. |
|
Hi @mountiny. Does this PR apply to iOS? There is no notification banner for the GPS trip Bug7168849_1780334685416.ScreenRecording_06-01-2026_11-40-36_1.mp4 |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.90-3 🚀
|
@IuliiaHerets This is Android only, iOS works differently as it uses Live Activity |
Re-applies #91155
We had to revert it, because the oldApp PR was not merged and deployed together with this change https://github.com/Expensify/Mobile-Expensify/pull/13944 - that is now in main so we can merge this again and it will go to next staging release together as it should
Explanation of Change
Replaces the Airship LiveUpdate-based GPS notification (introduced here) with a standalone Android foreground service (
GpsTripService) driven directly from JS via a newGpsTripServiceModulenative module. The old approach with Airship LiveUpdate was forcing us to use a simple service that was getting killed sometimes by the Low Memory Killer, changing it to a foreground service will make it higher priority making the service less likely to be killed.Bumps
expo-locationto^55.1.10to fix crashes caused by:when getting GPS updates in the background with active GPS trip.
Fixed Issues
$ #88700, #90931
PROPOSAL: N/A
MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/13944
Tests
Crashes # 1:
Crashes # 2:
Starting GPS trip and backgrounding the app:
Logging out:
App termination:
Continue GPS trip recording?modalContinue tripOffline tests
N/A — the GPS foreground service runs locally on-device and does not make network requests.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2026-05-20.at.09.26.29.mov
Screen.Recording.2026-05-20.at.09.23.05.mov
Screen.Recording.2026-05-20.at.09.20.37.mov
Screen.Recording.2026-05-20.at.09.19.50.mov