Skip to content

fix(app, android)!: run makeGooglePlayServicesAvailable on main thread#9107

Open
just1and0 wants to merge 1 commit into
mainfrom
fix/play-services-main-thread
Open

fix(app, android)!: run makeGooglePlayServicesAvailable on main thread#9107
just1and0 wants to merge 1 commit into
mainfrom
fix/play-services-main-thread

Conversation

@just1and0

Copy link
Copy Markdown
Contributor

Summary

  • GoogleApiAvailability.makeGooglePlayServicesAvailable() requires main thread execution but was being called from a React Native background queue, causing IllegalStateException on some Android devices.
  • Wraps the call in UiThreadUtil.runOnUiThread() in both the legacy module (ReactNativeFirebaseUtilsModule) and the Turbo module (NativeRNFBTurboUtils).
  • In the Turbo module, the Promise is now wired to the Google Task result via addOnCompleteListener, handling success, cancellation, and failure so the JS promise always settles.
  • Scope is limited to makeGooglePlayServicesAvailable; adjacent Play Services UI methods (promptForPlayServices, resolutionForPlayServices) are not changed in this PR.

Fixes #8948

Test plan

  • Build and run on an Android device without Google Play Services (or with outdated Play Services) and call androidMakePlayServicesAvailable() — should show the update dialog without crashing
  • Dismiss the update dialog — JS promise should reject with play-services-update-canceled
  • Verify normal flow on a device with current Play Services — should resolve immediately

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.79%. Comparing base (1eebb89) to head (a20a2c6).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9107      +/-   ##
============================================
- Coverage     65.84%   65.79%   -0.05%     
  Complexity     1832     1832              
============================================
  Files           497      497              
  Lines         38761    38774      +13     
  Branches       5723     5725       +2     
============================================
- Hits          25518    25506      -12     
- Misses        11770    11792      +22     
- Partials       1473     1476       +3     
Flag Coverage Δ
android-native 62.86% <0.00%> (-0.07%) ⬇️
e2e-ts-android 59.62% <0.00%> (-0.04%) ⬇️
e2e-ts-ios 62.75% <ø> (-0.06%) ⬇️
e2e-ts-macos 50.01% <ø> (ø)
ios-native 62.75% <ø> (-0.06%) ⬇️
jest 49.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mikehardy mikehardy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix is great - needs two tweaks to fit in the larger react-native-firebase context:

1- rebase on top of current main or merge main in and drop the touch on the old arch Java file
2- add v26 migration guide note on the new behavior as indicated

I'm hoping to release v26 soon and I want to ship this break as part of it so I may just do these changes then merge, as I have time

BREAKING CHANGE: On Android, makePlayServicesAvailable previously resolved even when the Play Services availability task was canceled or failed. It may now reject, so callers should handle Promise rejections.
@just1and0
just1and0 force-pushed the fix/play-services-main-thread branch from 17d0966 to a20a2c6 Compare July 20, 2026 11:17
@just1and0 just1and0 changed the title fix(app, android): run makeGooglePlayServicesAvailable on the main thread fix(app, android)!: run makeGooglePlayServicesAvailable on main thread Jul 20, 2026
@just1and0
just1and0 requested a review from mikehardy July 20, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛] IllegalStateException makeGooglePlayServicesAvailable must be called from the main thread

2 participants