diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.java deleted file mode 100644 index 8abfb22953..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.java +++ /dev/null @@ -1,21 +0,0 @@ -package info.nightscout.androidaps.receivers; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.Build; - -import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService; - -public class AutoStartReceiver extends BroadcastReceiver { - public AutoStartReceiver() { - } - - @Override - public void onReceive(Context context, Intent intent) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - context.startForegroundService(new Intent(context, DummyService.class)); - else - context.startService(new Intent(context, DummyService.class)); - } -} diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.kt new file mode 100644 index 0000000000..7b2eb03f96 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.kt @@ -0,0 +1,18 @@ +package info.nightscout.androidaps.receivers + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.os.Build +import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService + +class AutoStartReceiver : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + if (intent.action == Intent.ACTION_BOOT_COMPLETED) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) + context.startForegroundService(Intent(context, DummyService::class.java)) + else + context.startService(Intent(context, DummyService::class.java)) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.kt index f8fb246f22..484e19a1d5 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.kt +++ b/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.kt @@ -9,6 +9,8 @@ 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