refactor: simplify buffered location retry logic

- Remove immediate flush trigger on network change
- Buffered locations now retry on every location send and heartbeat
- Heartbeat interval already covers retry needs, no need for extra trigger
This commit is contained in:
fiatcode 2026-05-06 07:18:53 +07:00
parent 09009fee4c
commit 4e6d7e95e6
No known key found for this signature in database

View file

@ -79,7 +79,6 @@ class LocationTrackingService : Service() {
connectivityReceiver = ConnectivityReceiver { online ->
isNetworkAvailable = online
logEvent("NETWORK_CHANGE", "Network: ${if (online) "online" else "offline"}")
if (online) syncBufferedLocations()
}
val intentFilter = IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)
@ -389,6 +388,8 @@ class LocationTrackingService : Service() {
logEvent("ERROR", "Failed to send location: ${result.exceptionOrNull()?.message}")
bufferLocation(location)
}
// Also try to flush any buffered locations after each send attempt
syncBufferedLocations()
}
}