fix(android): add BootReceiver.kt (force-add past gitignore)
This commit is contained in:
1 parent
1f02eb1f26
commit
4306a19d7b
1 file changed
+18
@@ -0,0 +1,18 @@
|
||||
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) {
|
||||
val action = intent.action ?: return
|
||||
if (action == Intent.ACTION_BOOT_COMPLETED ||
|
||||
action == "android.intent.action.QUICKBOOT_POWERON"
|
||||
) {
|
||||
val serviceIntent = Intent(context, ForegroundService::class.java)
|
||||
context.startForegroundService(serviceIntent)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user