AndroidAPS/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.kt
2020-03-31 15:55:30 +02:00

24 lines
866 B
Kotlin

package info.nightscout.androidaps.receivers
import android.content.Context
import android.content.Intent
import androidx.legacy.content.*
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
// We are not ready to switch to JobScheduler
@Suppress("DEPRECATION")
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))
}
}