finish apllication after clicking Exit
This commit is contained in:
parent
ce16dd747b
commit
9d686adf7e
|
@ -161,8 +161,6 @@ public class NSClientService extends Service {
|
|||
destroy();
|
||||
|
||||
stopSelf();
|
||||
if (L.isEnabled(L.NSCLIENT))
|
||||
log.debug("EventAppExit finished");
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
|
@ -6,10 +6,21 @@ import android.content.Intent;
|
|||
import android.os.IBinder;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.events.EventAppExit;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
|
@ -24,8 +35,24 @@ public class DummyService extends Service {
|
|||
return START_STICKY;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(EventAppExit event) {
|
||||
if (L.isEnabled(L.CORE))
|
||||
log.debug("EventAppExit received");
|
||||
|
||||
stopSelf();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (L.isEnabled(L.CORE))
|
||||
log.debug("onDestroy");
|
||||
MainApp.bus().unregister(this);
|
||||
stopForeground(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -412,8 +412,6 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
|||
MainApp.instance().getApplicationContext().unregisterReceiver(receiver);
|
||||
|
||||
stopSelf();
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("EventAppExit finished");
|
||||
}
|
||||
|
||||
public PumpEnactResult setUserOptions() {
|
||||
|
|
|
@ -93,8 +93,6 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
MainApp.instance().getApplicationContext().unregisterReceiver(receiver);
|
||||
|
||||
stopSelf();
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("EventAppExit finished");
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
|
@ -526,8 +526,6 @@ public class DanaRSService extends Service {
|
|||
log.debug("EventAppExit received");
|
||||
|
||||
stopSelf();
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("EventAppExit finished");
|
||||
}
|
||||
|
||||
void waitForWholeMinute() {
|
||||
|
|
|
@ -112,8 +112,6 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
MainApp.instance().getApplicationContext().unregisterReceiver(receiver);
|
||||
|
||||
stopSelf();
|
||||
if (L.isEnabled(L.PUMP))
|
||||
log.debug("EventAppExit finished");
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
Loading…
Reference in a new issue