Added notification logging

pull/146/head
M66B 6 years ago
parent 542376d0be
commit 10d6f10fde

@ -188,7 +188,7 @@ public class ServiceSynchronize extends LifecycleService {
@Override
public void run() {
try {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Log.i(Helper.TAG, "Notification messages=" + messages.size());
Widget.update(ServiceSynchronize.this, messages.size());
@ -220,15 +220,23 @@ public class ServiceSynchronize extends LifecycleService {
Integer id = (int) notification.extras.getLong("id", 0);
if (id != 0) {
all.add(id);
if (removed.contains(id))
if (removed.contains(id)) {
removed.remove(id);
else {
Log.i(Helper.TAG, "Notification removing=" + id);
} else {
removed.remove(Integer.valueOf(-id));
added.add(id);
Log.i(Helper.TAG, "Notification adding=" + id);
}
}
}
Log.i(Helper.TAG, "Notification account=" + account +
" notifications=" + notifications.size() +
" all=" + all.size() + " added=" + added.size() + " removed=" + removed.size());
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notifications.size() == 0 ||
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O && added.size() > 0))
nm.cancel("unseen:" + account, 0);

Loading…
Cancel
Save