AndroidAPS/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.kt

18 lines
616 B
Kotlin
Raw Normal View History

2020-03-31 10:18:53 +02:00
package info.nightscout.androidaps.receivers
import android.content.Context
import android.content.Intent
2021-01-17 13:23:59 +01:00
import dagger.android.DaggerBroadcastReceiver
import info.nightscout.androidaps.plugins.general.persistentNotification.DummyServiceHelper
2021-01-20 15:56:46 +01:00
import javax.inject.Inject
2020-03-31 10:18:53 +02:00
2021-01-20 15:56:46 +01:00
class AutoStartReceiver : DaggerBroadcastReceiver() {
@Inject lateinit var dummyServiceHelper: DummyServiceHelper
2021-01-16 18:29:18 +01:00
2020-03-31 10:18:53 +02:00
override fun onReceive(context: Context, intent: Intent) {
2021-01-17 13:23:59 +01:00
super.onReceive(context, intent)
2021-01-16 18:29:18 +01:00
if (intent.action == Intent.ACTION_BOOT_COMPLETED)
2021-01-17 13:23:59 +01:00
dummyServiceHelper.startService(context)
2020-03-31 10:18:53 +02:00
}
}