mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-04 17:27:24 +01: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:
parent
dde8a5044f
commit
29dc806fb1
@ -209,6 +209,10 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
|
|
||||||
String source = sbn.getPackageName().toLowerCase();
|
String source = sbn.getPackageName().toLowerCase();
|
||||||
Notification notification = sbn.getNotification();
|
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 notificationSpec = new NotificationSpec();
|
||||||
notificationSpec.id = (int) sbn.getPostTime(); //FIXME: a truly unique id would be better
|
notificationSpec.id = (int) sbn.getPostTime(); //FIXME: a truly unique id would be better
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user