diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-05-09 20:43:54 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-05-09 20:43:54 +0200 |
commit | 699dbe2e2a56ac36160950c1ac06b16f59eab6c1 (patch) | |
tree | f5be01bf206b01b89d5eb4ee2dfcc43fa67659aa /src/main/java | |
parent | f4f71c7287a9ec8250e4b9d93bf58f5231e69597 (diff) |
avoid race condition that lead to double notification sound
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/NotificationService.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index e6c3fb052..56f0427c0 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -243,6 +243,7 @@ public class NotificationService { } public void updateNotification(final boolean notify) { + Log.d(Config.LOGTAG, "updateNotification(" + Boolean.toString(notify) + ")"); final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(mXmppConnectionService); final SharedPreferences preferences = mXmppConnectionService.getPreferences(); @@ -261,13 +262,14 @@ public class NotificationService { } else { Log.d(Config.LOGTAG, "Notification: Received multiple notification or using Android N"); mBuilder = buildMultipleConversation(); - notificationManager.notify(NOTIFICATION_ID, mBuilder.build()); + modifyForSoundVibrationAndLight(mBuilder, notify, preferences); for (Map.Entry<String, ArrayList<Message>> entry : notifications.entrySet()) { Builder singleBuilder = buildSingleConversations(entry.getValue()); singleBuilder.setGroup(CONVERSATIONS_GROUP); modifyForSoundVibrationAndLight(singleBuilder, notify, preferences); notificationManager.notify(entry.getKey(), NOTIFICATION_ID, singleBuilder.build()); } + notificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } } } |