From 08f3137c5b889bc5ecc1471c30330eb2fe828fcd Mon Sep 17 00:00:00 2001 From: Alexander Capehart Date: Sat, 11 Nov 2023 22:43:17 -0700 Subject: [PATCH] app: start service on draw-time Recently, Android 14 seemed to have finally made it impossible to start services in onStart. I never realized this error since I thought onStart signified the beginning of the foreground state, when it was actually onResume. I think it only worked prior due to race conditions. Try to fix it by moving the service starting code to onResume. See #608. --- app/src/main/java/org/oxycblt/auxio/MainActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/oxycblt/auxio/MainActivity.kt b/app/src/main/java/org/oxycblt/auxio/MainActivity.kt index 725f60444..c98d89cdd 100644 --- a/app/src/main/java/org/oxycblt/auxio/MainActivity.kt +++ b/app/src/main/java/org/oxycblt/auxio/MainActivity.kt @@ -68,8 +68,8 @@ class MainActivity : AppCompatActivity() { logD("Activity created") } - override fun onStart() { - super.onStart() + override fun onResume() { + super.onResume() startService(Intent(this, IndexerService::class.java)) startService(Intent(this, PlaybackService::class.java))