run DummyService on start instead of NSClientService

This commit is contained in:
Milos Kozak 2019-08-08 19:44:22 +02:00
parent d467d679df
commit f26069db00

View file

@ -3,8 +3,9 @@ package info.nightscout.androidaps.plugins.general.nsclient.receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientService;
import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService;
public class AutoStartReceiver extends BroadcastReceiver {
public AutoStartReceiver() {
@ -12,6 +13,9 @@ public class AutoStartReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
context.startService(new Intent(context, NSClientService.class));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
context.startForegroundService(new Intent(context, DummyService.class));
else
context.startService(new Intent(context, DummyService.class));
}
}