Reset arrived_at_home while resetting listeners, not sleeping.

This commit is contained in:
voussoir 2023-04-02 12:13:19 -07:00
parent 1a18ac22e4
commit 3a4ae9d723

View file

@ -202,6 +202,10 @@ class TrackerService: Service()
if (gps_added || network_added) if (gps_added || network_added)
{ {
listeners_enabled_at = System.currentTimeMillis() listeners_enabled_at = System.currentTimeMillis()
if (interval != Keys.LOCATION_INTERVAL_SLEEP)
{
arrived_at_home = 0
}
} }
else else
{ {
@ -284,7 +288,6 @@ class TrackerService: Service()
if (arrived_at_home > 0) if (arrived_at_home > 0)
{ {
Log.i("VOUSSOIR", "Leaving home.") Log.i("VOUSSOIR", "Leaving home.")
arrived_at_home = 0
reset_location_listeners(interval=Keys.LOCATION_INTERVAL_FULL_POWER) reset_location_listeners(interval=Keys.LOCATION_INTERVAL_FULL_POWER)
} }
@ -613,7 +616,6 @@ class TrackerService: Service()
fun startTracking() fun startTracking()
{ {
Log.i("VOUSSOIR", "TrackerService.startTracking") Log.i("VOUSSOIR", "TrackerService.startTracking")
arrived_at_home = 0
reset_location_listeners(interval=Keys.LOCATION_INTERVAL_FULL_POWER) reset_location_listeners(interval=Keys.LOCATION_INTERVAL_FULL_POWER)
trackingState = Keys.STATE_TRACKING_ACTIVE trackingState = Keys.STATE_TRACKING_ACTIVE
PreferencesHelper.saveTrackingState(trackingState) PreferencesHelper.saveTrackingState(trackingState)
@ -625,7 +627,6 @@ class TrackerService: Service()
{ {
Log.i("VOUSSOIR", "TrackerService.stopTracking") Log.i("VOUSSOIR", "TrackerService.stopTracking")
trackbook.database.commit() trackbook.database.commit()
arrived_at_home = 0
reset_location_listeners(interval=Keys.LOCATION_INTERVAL_FULL_POWER) reset_location_listeners(interval=Keys.LOCATION_INTERVAL_FULL_POWER)
trackingState = Keys.STATE_TRACKING_STOPPED trackingState = Keys.STATE_TRACKING_STOPPED
PreferencesHelper.saveTrackingState(trackingState) PreferencesHelper.saveTrackingState(trackingState)