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.
This commit is contained in:
ssbg04 committed 2026-08-18 13:25:49 +08:00
1 parent 648280ab45
commit 281a782b93
1 file changed
-3
@@ -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)
}
}