From 012593a48014cd11ed624a20f14c4e2e2888f6b5 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 3 May 2018 12:18:48 +0200 Subject: [PATCH] Update NotificationStore.java --- .../Overview/notifications/NotificationStore.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 7504a19a76..8f537c1d74 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 @@ -37,6 +37,7 @@ public class NotificationStore { private static Logger log = LoggerFactory.getLogger(NotificationStore.class); public List store = new ArrayList(); public long snoozedUntil = 0L; + private boolean usesChannels; public NotificationStore() { createNotificationChannel(); @@ -62,6 +63,12 @@ public class NotificationStore { if (SP.getBoolean(MainApp.gs(R.string.key_raise_notifications_as_android_notifications), false)) { raiseSystemNotification(n); + if (usesChannels && n.soundId != null) { + Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class); + alarm.putExtra("soundid", n.soundId); + MainApp.instance().startService(alarm); + } + } else { if (n.soundId != null) { Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class); @@ -138,7 +145,7 @@ public class NotificationStore { private void createNotificationChannel() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - + usesChannels = true; NotificationManager mNotificationManager = (NotificationManager) MainApp.instance().getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); @SuppressLint("WrongConstant") NotificationChannel channel = new NotificationChannel(CHANNEL_ID,