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