1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-23 07:11:52 +02:00

Ignore notifications that are older than 1 second

In case of grouped notifications, we get multiple notifications
also if the android device shows only one.

This means that with this change the most recently updated chat
will get through, but others will not.

This should help with #1062 and #657
This commit is contained in:
Daniele Gobbetti 2018-10-28 17:58:24 +01:00
parent dde8a5044f
commit 29dc806fb1

View File

@ -209,6 +209,10 @@ public class NotificationListener extends NotificationListenerService {
String source = sbn.getPackageName().toLowerCase();
Notification notification = sbn.getNotification();
if (notification.when < (sbn.getPostTime() - 1000)) {
LOG.info("NOT processing notification, too old. notification.when: " + notification.when + " post time: " + sbn.getPostTime() + " now: " + System.currentTimeMillis());
return;
}
NotificationSpec notificationSpec = new NotificationSpec();
notificationSpec.id = (int) sbn.getPostTime(); //FIXME: a truly unique id would be better