Skip to content

GPS: Keep location resends compatible with Android 4.1 - #1208

Merged
o-jcardenass merged 1 commit into
andreknieriem:mainfrom
emotionbug:pr/android16-gps-resend
Oct 30, 2026
Merged

o-jcardenass merged 1 commit into
andreknieriem:mainfrom
emotionbug:pr/android16-gps-resend

Conversation

@emotionbug

Copy link
Copy Markdown
Contributor

The GitHub build still supports API 16, but the periodic GPS resend calls both SystemClock.elapsedRealtimeNanos() and Location.setElapsedRealtimeNanos(), which were added in API 17. A recent GPS fix can therefore reach a missing-method failure on Android 4.1.

Keep resending a copy with a fresh wall-clock timestamp on API 16, and refresh the monotonic timestamp only on API 17+. The original fix, resend interval and stale-fix cutoff are unchanged.

@emotionbug
emotionbug force-pushed the pr/android16-gps-resend branch from 1147e42 to 59621b1 Compare October 28, 2026 09:57
@emotionbug emotionbug changed the title Fix GPS fix resends on Android 4.1 GPS: Keep location resends compatible with Android 4.1 Oct 28, 2026
Keep the periodic headunit GPS resend available on API 16 without
calling SystemClock.elapsedRealtimeNanos or
Location.setElapsedRealtimeNanos, which were introduced in API 17.
Refresh the outgoing location's wall-clock timestamp on every supported
version and its monotonic timestamp only where the framework provides
both APIs.

Continue copying the last real fix rather than changing the stored fix
or lastGpsFixAtMs. A resend must not renew the age of the original
observation: the existing interval and stale-fix cutoff still determine
when the phone should fall back to its own location. Missing monotonic
timestamp support must not disable that bounded resend path.

Retain the existing GPS fallback rationale and explain the timestamp
ownership and version boundary next to the resend.
@emotionbug
emotionbug force-pushed the pr/android16-gps-resend branch from fd4687d to aca4a09 Compare October 28, 2026 16:12
@o-jcardenass
o-jcardenass merged commit a47f600 into andreknieriem:main Oct 30, 2026
2 of 3 checks passed
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