From 281a782b93454e770c42840c5491142a33309dec Mon Sep 17 00:00:00 2001 From: ssbg04 Date: Tue, 18 Aug 2026 13:25:49 +0800 Subject: [PATCH] fix(android): remove startForegroundService from BootReceiver (crash on boot) ForegroundService requires a live Flutter engine and cannot be cold-started from a BroadcastReceiver. flutter_foreground_task handles boot-restart internally via autoRunOnBoot=true. BootReceiver now only reschedules the AlarmManager chain. --- .../app/src/main/kotlin/com/teamsb/tis_rms/BootReceiver.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/android/app/src/main/kotlin/com/teamsb/tis_rms/BootReceiver.kt b/frontend/android/app/src/main/kotlin/com/teamsb/tis_rms/BootReceiver.kt index b413c5d..0b23bf1 100644 --- a/frontend/android/app/src/main/kotlin/com/teamsb/tis_rms/BootReceiver.kt +++ b/frontend/android/app/src/main/kotlin/com/teamsb/tis_rms/BootReceiver.kt @@ -3,7 +3,6 @@ package com.teamsb.tis_rms import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import com.pravera.flutter_foreground_task.service.ForegroundService class BootReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { @@ -11,8 +10,6 @@ class BootReceiver : BroadcastReceiver() { if (action == Intent.ACTION_BOOT_COMPLETED || action == "android.intent.action.QUICKBOOT_POWERON" ) { - val serviceIntent = Intent(context, ForegroundService::class.java) - context.startForegroundService(serviceIntent) AlarmScheduler.schedule(context) } }