From fee3a753691d015f987a53b6fb55005729a858f0 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 29 Dec 2015 09:28:29 +0100 Subject: [PATCH] Attempt to workaround notification disappearing Refs #200 --- .../main/java/eu/faircode/netguard/SinkholeService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/SinkholeService.java b/app/src/main/java/eu/faircode/netguard/SinkholeService.java index 928b46c5..0d86cf48 100644 --- a/app/src/main/java/eu/faircode/netguard/SinkholeService.java +++ b/app/src/main/java/eu/faircode/netguard/SinkholeService.java @@ -459,7 +459,8 @@ public class SinkholeService extends VpnService { .setVisibility(Notification.VISIBILITY_PUBLIC) .setPriority(Notification.PRIORITY_DEFAULT) .setColor(ContextCompat.getColor(SinkholeService.this, R.color.colorPrimary)) - .setOngoing(true); + .setOngoing(true) + .setAutoCancel(false); NotificationManagerCompat.from(SinkholeService.this).notify(NOTIFY_TRAFFIC, builder.build()); } @@ -900,7 +901,9 @@ public class SinkholeService extends VpnService { .setCategory(Notification.CATEGORY_STATUS) .setVisibility(Notification.VISIBILITY_SECRET) .setPriority(Notification.PRIORITY_MIN) - .setColor(ContextCompat.getColor(this, R.color.colorPrimary)); + .setColor(ContextCompat.getColor(this, R.color.colorPrimary)) + .setOngoing(true) + .setAutoCancel(false); if (allowed > 0 || blocked > 0) { NotificationCompat.BigTextStyle notification = new NotificationCompat.BigTextStyle(builder); @@ -923,6 +926,7 @@ public class SinkholeService extends VpnService { .setCategory(Notification.CATEGORY_STATUS) .setVisibility(Notification.VISIBILITY_SECRET) .setColor(ContextCompat.getColor(this, R.color.colorAccent)) + .setOngoing(false) .setAutoCancel(true); NotificationManagerCompat.from(this).notify(NOTIFY_DISABLED, notification.build());