fix(location): Use LocationManager instead of FusedLocationProviderClient#20
Open
bgweaver wants to merge 1 commit into
Open
fix(location): Use LocationManager instead of FusedLocationProviderClient#20bgweaver wants to merge 1 commit into
bgweaver wants to merge 1 commit into
Conversation
…er for Play Services-free devices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On GrapheneOS (and other ROMs without Google Play Services), the Location
subsystem always shows Error(code=-1, message=No location available). This
is because FusedLocationProviderClient requires Play Services, which returns
null silently when unavailable.
All other subsystems (BLE, WiFi, Cellular, Satellite, GNSS) work correctly —
only the location stamping on detections was broken.
Fix
Replace FusedLocationProviderClient with Android's native LocationManager,
which works on any AOSP-based ROM without Play Services dependency.
Falls back through GPS → FUSED → NETWORK providers, and requests a single
update if no last known location is cached.
Tested on
Before: Location → Error(code=-1)
After: Location → Active, detections stamped with coordinates