Skip to content

Commit

Permalink
Re-register for locations updates (revert register only once for loca…
Browse files Browse the repository at this point in the history
…tion updates). Attempt to fix locations updates sometimes not received until forced re-register.
  • Loading branch information
anyuta1166 committed Jul 6, 2022
1 parent 2055fb3 commit 7ef19d9
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ class LocationSensorManager : BroadcastReceiver(), SensorManager {
)
internal const val TAG = "LocBroadcastReceiver"

private var isBackgroundLocationSetup = false
private var isZoneLocationSetup = false

private var lastLocationSend = 0L
private var lastUpdateLocation = ""
}
Expand Down Expand Up @@ -109,17 +106,11 @@ class LocationSensorManager : BroadcastReceiver(), SensorManager {

ioScope.launch {
try {
if (!backgroundEnabled && !zoneEnabled) {
removeAllLocationUpdateRequests()
isBackgroundLocationSetup = false
isZoneLocationSetup = false
}
if (backgroundEnabled && !isBackgroundLocationSetup) {
isBackgroundLocationSetup = true
removeAllLocationUpdateRequests()
if (backgroundEnabled) {
requestLocationUpdates()
}
if (zoneEnabled && !isZoneLocationSetup) {
isZoneLocationSetup = true
if (zoneEnabled) {
requestZoneUpdates()
}
} catch (e: Exception) {
Expand Down

0 comments on commit 7ef19d9

Please sign in to comment.