From 37c5754a24aa801d3c6ee24146585462d343e565 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 30 Nov 2023 17:41:45 -0800 Subject: [PATCH] Go to dead state if app tries to record without database ready. --- app/src/main/java/net/voussoir/trkpt/TrackerService.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/voussoir/trkpt/TrackerService.kt b/app/src/main/java/net/voussoir/trkpt/TrackerService.kt index b00e6c8..c707d4e 100644 --- a/app/src/main/java/net/voussoir/trkpt/TrackerService.kt +++ b/app/src/main/java/net/voussoir/trkpt/TrackerService.kt @@ -215,6 +215,10 @@ class TrackerService: Service() // at full power. A wakelock is used to resist Android's doze. This state should be active // while out and about. Log.i("VOUSSOIR", "TrackerService.state_full_power") + if (! trackbook.database.ready) + { + state_dead() + } tracking_state = Keys.STATE_FULL_RECORDING PreferencesHelper.saveTrackingState(tracking_state) reset_location_listeners(Keys.LOCATION_INTERVAL_FULL_POWER) @@ -365,7 +369,8 @@ class TrackerService: Service() if(! trackbook.database.ready) { - Log.i("VOUSSOIR", "Omitting due to database not ready.") + Log.i("VOUSSOIR", "TrackerService.onLocationChanged: database is not ready!!.") + state_dead() return }