Skip to content

Fix geofence expiration overflow#2245

Open
Cooad wants to merge 2 commits into
owntracks:masterfrom
Cooad:fix/geofence-expiration-overflow
Open

Fix geofence expiration overflow#2245
Cooad wants to merge 2 commits into
owntracks:masterfrom
Cooad:fix/geofence-expiration-overflow

Conversation

@Cooad
Copy link
Copy Markdown

@Cooad Cooad commented May 19, 2026

GMS geofence registration silently fails with ApiException: 10 on devices with significant uptime. GMS internally computes elapsedRealtime() + expirationDuration to derive an absolute expiration time. When expirationDuration is Long.MAX_VALUE (the NEVER_EXPIRE constant), this addition overflows the signed long, producing a negative value that GMS rejects as invalid. The failure was silent because neither success nor failure was logged.
Fix:

  • Add success/failure logging to GMSGeofencingClient so registration outcomes are visible in device logs
  • Cap expirationDuration to Long.MAX_VALUE - SystemClock.elapsedRealtime() to prevent overflow

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.

1 participant