Don't treat unbind as dead.
This commit is contained in:
parent
328e56cb05
commit
97c2ccb4d5
2 changed files with 8 additions and 3 deletions
|
@ -71,6 +71,7 @@ object Keys {
|
||||||
const val LOCATION_INTERVAL_FULL_POWER: Long = 0
|
const val LOCATION_INTERVAL_FULL_POWER: Long = 0
|
||||||
const val LOCATION_INTERVAL_SLEEP: Long = ONE_MINUTE_IN_MILLISECONDS
|
const val LOCATION_INTERVAL_SLEEP: Long = ONE_MINUTE_IN_MILLISECONDS
|
||||||
const val LOCATION_INTERVAL_DEAD: Long = -1
|
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_FOLLOW_SYSTEM: String = "stateFollowSystem"
|
||||||
const val STATE_THEME_LIGHT_MODE: String = "stateLightMode"
|
const val STATE_THEME_LIGHT_MODE: String = "stateLightMode"
|
||||||
const val STATE_THEME_DARK_MODE: String = "stateDarkMode"
|
const val STATE_THEME_DARK_MODE: String = "stateDarkMode"
|
||||||
|
|
|
@ -178,7 +178,7 @@ class TrackerService: Service()
|
||||||
location_interval = interval
|
location_interval = interval
|
||||||
var gps_added = false
|
var gps_added = false
|
||||||
var network_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)
|
gps_added = addGpsLocationListener(interval)
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ class TrackerService: Service()
|
||||||
{
|
{
|
||||||
removeGpsLocationListener()
|
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)
|
network_added = addNetworkLocationListener(interval)
|
||||||
}
|
}
|
||||||
|
@ -203,6 +203,10 @@ class TrackerService: Service()
|
||||||
arrived_at_home = 0
|
arrived_at_home = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (interval == Keys.LOCATION_INTERVAL_STOP)
|
||||||
|
{
|
||||||
|
listeners_enabled_at = 0
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
listeners_enabled_at = 0
|
listeners_enabled_at = 0
|
||||||
|
@ -479,7 +483,7 @@ class TrackerService: Service()
|
||||||
// stop receiving location updates - if not tracking
|
// stop receiving location updates - if not tracking
|
||||||
if (trackingState != Keys.STATE_TRACKING_ACTIVE)
|
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
|
// ensures onRebind is called
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in a new issue