diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/NotificationStore.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/NotificationStore.java index b640b90077..a3bfb0d03b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/NotificationStore.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/NotificationStore.java @@ -21,7 +21,6 @@ import java.util.List; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.AlarmSoundService; -import info.nightscout.androidaps.plugins.Wear.WearPlugin; import info.nightscout.utils.SP; /** @@ -58,8 +57,7 @@ public class NotificationStore { store.add(n); - if (SP.getBoolean(MainApp.sResources.getString(R.string.key_raise_urgent_alarms_as_android_notification), false) - && n.level == Notification.URGENT) { + if (SP.getBoolean(MainApp.sResources.getString(R.string.key_raise_notifications_as_android_notifications), false)) { raiseSystemNotification(n); } else { if (n.soundId != null) { @@ -69,11 +67,10 @@ public class NotificationStore { } //Only pipe through to wear if no system notification is raised (should show on wear anyways) - WearPlugin wearPlugin = MainApp.getSpecificPlugin(WearPlugin.class); + /*WearPlugin wearPlugin = MainApp.getSpecificPlugin(WearPlugin.class); if(wearPlugin!= null && wearPlugin.isEnabled()) { wearPlugin.overviewNotification(n.id, "OverviewNotification:\n" + n.text); - } - + }*/ } Collections.sort(store, new NotificationComparator()); @@ -91,9 +88,13 @@ public class NotificationStore { .setContentTitle("Urgent alarm") .setContentText(n.text) .setPriority(NotificationCompat.PRIORITY_HIGH) - .setVibrate(new long[] { 1000, 1000, 1000, 1000}) - .setSound(sound, AudioAttributes.USAGE_ALARM) .setDeleteIntent(DismissNotificationService.deleteIntent(n.id)); + if (n.level == Notification.URGENT) { + notificationBuilder.setVibrate(new long[]{1000, 1000, 1000, 1000}) + .setSound(sound, AudioAttributes.USAGE_ALARM); + } else { + notificationBuilder.setVibrate(new long[]{0, 100, 50, 100, 50}); + } mgr.notify(n.id, notificationBuilder.build()); } diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java index c38ff97949..809fc7e45e 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java @@ -82,11 +82,10 @@ public class KeepAliveReceiver extends BroadcastReceiver { boolean alarmTimeoutExpired = lastConnection.getTime() + pumpUnreachableThreshold() < System.currentTimeMillis(); boolean nextAlarmOccurrenceReached = SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis(); - if (SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_pump_unreachable_alert), false) + if (SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_pump_unreachable_alert), true) && isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached) { Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.sResources.getString(R.string.pump_unreachable), Notification.URGENT); n.soundId = R.raw.alarm; - SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold()); SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold()); MainApp.bus().post(new EventNewNotification(n)); } else if (SP.getBoolean("syncprofiletopump", false) && !pump.isThisProfileSet(profile)) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4edee10b09..d05fbdb41e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -759,8 +759,8 @@ Starting bolus delivery Pump unreachable Missed BG readings - raise_urgent_alarms_as_android_notification - Use system notifications for alerts + raise_urgent_alarms_as_android_notification + Use system notifications for alerts and notifications enable_pump_unreachable_alert enable_missed_bg_readings Local alerts diff --git a/app/src/main/res/xml/pref_others.xml b/app/src/main/res/xml/pref_others.xml index 8e4f0d1731..00048e4b7a 100644 --- a/app/src/main/res/xml/pref_others.xml +++ b/app/src/main/res/xml/pref_others.xml @@ -72,8 +72,7 @@ android:key="short_tabtitles" android:title="@string/short_tabtitles"/> - - - + +