refactor cancelAlarm back to KeepAliveReceiver
This commit is contained in:
parent
9bd0a1f144
commit
00f13d0479
|
@ -69,7 +69,6 @@ import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
|
|||
import info.nightscout.androidaps.receivers.DataReceiver;
|
||||
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
|
||||
import info.nightscout.androidaps.receivers.NSAlarmReceiver;
|
||||
import info.nightscout.utils.LocalAlertUtils;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
|
@ -214,7 +213,7 @@ public class MainApp extends Application {
|
|||
|
||||
public void stopKeepAliveService() {
|
||||
if (keepAliveReceiver != null)
|
||||
LocalAlertUtils.cancelAlarm(this);
|
||||
KeepAliveReceiver.cancelAlarm(this);
|
||||
}
|
||||
|
||||
public static Bus bus() {
|
||||
|
|
|
@ -27,6 +27,13 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
private static Logger log = LoggerFactory.getLogger(KeepAliveReceiver.class);
|
||||
public static final long STATUS_UPDATE_FREQUENCY = 15 * 60 * 1000L;
|
||||
|
||||
public static void cancelAlarm(Context context) {
|
||||
Intent intent = new Intent(context, KeepAliveReceiver.class);
|
||||
PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, 0);
|
||||
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
alarmManager.cancel(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent rIntent) {
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
|
|
|
@ -57,13 +57,6 @@ public class LocalAlertUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void cancelAlarm(Context context) {
|
||||
Intent intent = new Intent(context, KeepAliveReceiver.class);
|
||||
PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, 0);
|
||||
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
alarmManager.cancel(sender);
|
||||
}
|
||||
|
||||
public static void shortenSnoozeInterval() {
|
||||
//shortens alarm times in case of setting changes or future data
|
||||
long nextMissedReadingsAlarm = SP.getLong("nextMissedReadingsAlarm", 0L);
|
||||
|
|
Loading…
Reference in a new issue