diff --git a/app/src/main/java/net/voussoir/trkpt/Keys.kt b/app/src/main/java/net/voussoir/trkpt/Keys.kt index 0b9cb73..9929c00 100644 --- a/app/src/main/java/net/voussoir/trkpt/Keys.kt +++ b/app/src/main/java/net/voussoir/trkpt/Keys.kt @@ -71,6 +71,7 @@ object Keys { const val LOCATION_INTERVAL_FULL_POWER: Long = 0 const val LOCATION_INTERVAL_SLEEP: Long = ONE_MINUTE_IN_MILLISECONDS const val LOCATION_INTERVAL_DEAD: Long = -1 + const val LOCATION_INTERVAL_STOP: Long = -2 const val STATE_THEME_FOLLOW_SYSTEM: String = "stateFollowSystem" const val STATE_THEME_LIGHT_MODE: String = "stateLightMode" const val STATE_THEME_DARK_MODE: String = "stateDarkMode" diff --git a/app/src/main/java/net/voussoir/trkpt/TrackerService.kt b/app/src/main/java/net/voussoir/trkpt/TrackerService.kt index 2cc0843..1fbb4c3 100644 --- a/app/src/main/java/net/voussoir/trkpt/TrackerService.kt +++ b/app/src/main/java/net/voussoir/trkpt/TrackerService.kt @@ -178,7 +178,7 @@ class TrackerService: Service() location_interval = interval var gps_added = false var network_added = false - if (use_gps_location && interval != Keys.LOCATION_INTERVAL_DEAD) + if (use_gps_location && interval != Keys.LOCATION_INTERVAL_DEAD && interval != Keys.LOCATION_INTERVAL_STOP) { gps_added = addGpsLocationListener(interval) } @@ -186,7 +186,7 @@ class TrackerService: Service() { removeGpsLocationListener() } - if (use_network_location && interval != Keys.LOCATION_INTERVAL_DEAD) + if (use_network_location && interval != Keys.LOCATION_INTERVAL_DEAD && interval != Keys.LOCATION_INTERVAL_STOP) { network_added = addNetworkLocationListener(interval) } @@ -203,6 +203,10 @@ class TrackerService: Service() arrived_at_home = 0 } } + else if (interval == Keys.LOCATION_INTERVAL_STOP) + { + listeners_enabled_at = 0 + } else { listeners_enabled_at = 0 @@ -479,7 +483,7 @@ class TrackerService: Service() // stop receiving location updates - if not tracking if (trackingState != Keys.STATE_TRACKING_ACTIVE) { - reset_location_listeners(interval=Keys.LOCATION_INTERVAL_DEAD) + reset_location_listeners(interval=Keys.LOCATION_INTERVAL_STOP) } // ensures onRebind is called return true