Skip to content

fix: record GPS when location was off as the app started - #8

Open
letharion wants to merge 5 commits into
gerhardol:feature/fix-deprecatedfrom
letharion:fix/gps-provider-check
Open

letharion wants to merge 5 commits into
gerhardol:feature/fix-deprecatedfrom
letharion:fix/gps-provider-check

Conversation

@letharion

Copy link
Copy Markdown

The new check, LocationManagerCompat.hasProvider, returns false also when the location provider is temporarily turned off, which can lead to some odd results.

Steps to reproduce:

  1. Force close app.
  2. Turn location.
  3. Start the app, either let the apps prompt to enable GPS do that, or manually turn location on again.
  4. Check the app says acceptable/good GPS.
  5. Start a run.

Expected result: GPS being recorded.
Actual result: The app has already determined that there's no location available, which means there's no tracking. I get a run with 0 seconds and 0 meters.

gerhardol and others added 5 commits October 4, 2026 10:45
replace calls to deprecated apis
annotate where needed for older APIs

Migrate to LocationListenerCompat

Mostly CoPilot, some manual changes and tweaks
as well as manual comments.
so local/GithubActions version are aligned
TrackerGPS.onInit replaced the deprecated getProvider(GPS_PROVIDER) ==
null with !isProviderEnabled(GPS_PROVIDER), which also reports "not
supported" when location is merely switched off. A component that is
not supported at init is skipped when the tracker connects, so if
RunnerUp was opened with location off and location was then switched
on, the run recorded no GPS: 0 points, 0 m and 0 s, while the start
screen showed a good fix from its own listener.

Check whether the device has a GPS provider, as before, with
LocationManagerCompat.hasProvider.
@gerhardol

Copy link
Copy Markdown
Owner

Could use some more Compat in GpsStatus too, will update before changing from draft
Pushed this and other updates to tmp/deprecated

@gerhardol
gerhardol force-pushed the feature/fix-deprecated branch from 2436309 to bd0745c Compare October 11, 2026 20:32
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.

2 participants