DummyService javadoc
This commit is contained in:
parent
a590a8be42
commit
ef237ed378
1 changed files with 5 additions and 2 deletions
|
@ -5,8 +5,10 @@ import android.app.Service;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keeps AndroidAPS in foreground state, so it won't be terminated by Android nor get restricted by the background execution limits
|
||||||
|
*/
|
||||||
public class DummyService extends Service {
|
public class DummyService extends Service {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,7 +19,8 @@ public class DummyService extends Service {
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification();
|
Notification notification = PersistentNotificationPlugin.getPlugin().updateNotification();
|
||||||
if (notification != null) startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification);
|
if (notification != null)
|
||||||
|
startForeground(PersistentNotificationPlugin.ONGOING_NOTIFICATION_ID, notification);
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue