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:
parent
09009fee4c
commit
4e6d7e95e6
1 changed files with 2 additions and 1 deletions
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue