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

24 lines
866 B
Kotlin
Raw Normal View History

2020-03-31 10:10:48 +02:00
package info.nightscout.androidaps.receivers
import android.content.Context
import android.content.Intent
2020-03-31 15:55:30 +02:00
import androidx.legacy.content.*
2020-03-31 10:10:48 +02:00
import dagger.android.AndroidInjection
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.services.DataService
import javax.inject.Inject
2020-03-31 10:18:53 +02:00
// We are not ready to switch to JobScheduler
@Suppress("DEPRECATION")
2020-03-31 10:10:48 +02:00
open class DataReceiver : WakefulBroadcastReceiver() {
@Inject lateinit var aapsLogger: AAPSLogger
override fun onReceive(context: Context, intent: Intent) {
AndroidInjection.inject(this, context)
aapsLogger.debug(LTag.DATASERVICE, "onReceive $intent")
startWakefulService(context, Intent(context, DataService::class.java)
.setAction(intent.action)
.putExtras(intent))
}
}