Added notification logging

This commit is contained in:
M66B 2018-12-09 19:33:55 +01:00
parent 542376d0be
commit 10d6f10fde
1 changed files with 11 additions and 3 deletions

View File

@ -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);