Merge branch 'koreandanar' of https://github.com/MilosKozak/AndroidAPS into koreandanar
This commit is contained in:
commit
d72a3cbf36
2 changed files with 26 additions and 10 deletions
|
@ -39,8 +39,6 @@ import info.nightscout.utils.LocaleHelper;
|
|||
public class MainActivity extends AppCompatActivity {
|
||||
private static Logger log = LoggerFactory.getLogger(MainActivity.class);
|
||||
|
||||
private static KeepAliveReceiver keepAliveReceiver;
|
||||
|
||||
static final int CASE_STORAGE = 0x1;
|
||||
static final int CASE_SMS = 0x2;
|
||||
|
||||
|
@ -77,11 +75,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
// no action
|
||||
}
|
||||
|
||||
if (keepAliveReceiver == null) {
|
||||
keepAliveReceiver = new KeepAliveReceiver();
|
||||
startService(new Intent(this, ExecutionService.class));
|
||||
keepAliveReceiver.setAlarm(this);
|
||||
}
|
||||
|
||||
setUpTabs(false);
|
||||
}
|
||||
|
||||
|
@ -169,8 +163,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
// break;
|
||||
case R.id.nav_exit:
|
||||
log.debug("Exiting");
|
||||
keepAliveReceiver.cancelAlarm(this);
|
||||
|
||||
MainApp.instance().stopKeepAliveService();
|
||||
MainApp.bus().post(new EventAppExit());
|
||||
MainApp.closeDbHelper();
|
||||
finish();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
|
@ -37,11 +38,13 @@ import info.nightscout.androidaps.plugins.TempBasals.TempBasalsFragment;
|
|||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
|
||||
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpFragment;
|
||||
import info.nightscout.androidaps.plugins.Wear.WearFragment;
|
||||
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
|
||||
public class MainApp extends Application {
|
||||
private static Logger log = LoggerFactory.getLogger(MainApp.class);
|
||||
private static KeepAliveReceiver keepAliveReceiver;
|
||||
|
||||
private static Bus sBus;
|
||||
private static MainApp sInstance;
|
||||
|
@ -94,6 +97,26 @@ public class MainApp extends Application {
|
|||
MainApp.getConfigBuilder().initialize();
|
||||
}
|
||||
MainApp.getConfigBuilder().uploadAppStart();
|
||||
|
||||
startKeepAliveService();
|
||||
}
|
||||
|
||||
private void startKeepAliveService() {
|
||||
if (keepAliveReceiver == null) {
|
||||
keepAliveReceiver = new KeepAliveReceiver();
|
||||
if (Config.DANAR) {
|
||||
startService(new Intent(this, info.nightscout.androidaps.plugins.DanaR.Services.ExecutionService.class));
|
||||
startService(new Intent(this, info.nightscout.androidaps.plugins.DanaRKorean.Services.ExecutionService.class));
|
||||
}
|
||||
keepAliveReceiver.setAlarm(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void stopKeepAliveService(){
|
||||
if(keepAliveReceiver!=null)
|
||||
keepAliveReceiver.cancelAlarm(this);
|
||||
}
|
||||
|
||||
public static Bus bus() {
|
||||
|
|
Loading…
Reference in a new issue