From 334bfa3f18b8c243f022cec4571975cacb3ac422 Mon Sep 17 00:00:00 2001 From: Brayo Date: Sat, 19 Sep 2026 20:50:29 +0300 Subject: [PATCH] fix(onboarding): relaunch MainActivity after onboarding finishes MainActivity finishes itself when it hands off to OnboardingActivity, so when the user granted Usage Access during onboarding and tapped FINISH, the task simply ended and the user landed on the launcher. Nothing started the BackgroundService (aw-server-rust, sync scheduler) until the app was opened a second time. Start MainActivity explicitly before finishing onboarding so the normal startup path (service start, alarms, initial fragment) runs immediately. --- .../main/java/net/activitywatch/android/OnboardingActivity.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mobile/src/main/java/net/activitywatch/android/OnboardingActivity.kt b/mobile/src/main/java/net/activitywatch/android/OnboardingActivity.kt index e1dcdf5e..259188ea 100644 --- a/mobile/src/main/java/net/activitywatch/android/OnboardingActivity.kt +++ b/mobile/src/main/java/net/activitywatch/android/OnboardingActivity.kt @@ -67,6 +67,10 @@ class OnboardingActivity : AppCompatActivity() { // First, check if the user has granted the usage permission if(UsageStatsWatcher.isUsageAllowed(this)) { AWPreferences(this).setFirstTimeRunFlag() + // MainActivity finished itself when it handed off to onboarding, so + // relaunch it here; otherwise the task ends at the launcher and the + // BackgroundService (server + sync) never starts until the next open. + startActivity(Intent(this, MainActivity::class.java)) finish() } else { // Show a snackbar and don't finish the activity