From 69d74b6c74ce2ea31d2fad8b62a4eb983693de13 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 28 Feb 2021 21:34:27 +0100 Subject: set early foreground notification for void vpn service --- .../main/java/se/leap/bitmaskclient/eip/VoidVpnService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java index 02de7574..35d2b376 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java @@ -76,7 +76,6 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat eipStatus = EipStatus.getInstance(); eipStatus.addObserver(this); notificationManager = new VpnNotificationManager(this); - notificationManager.createVoidVpnNotificationChannel(); } @Override @@ -94,6 +93,7 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat thread.run(); } else if (action.equals("android.net.VpnService") && Build.VERSION.SDK_INT >= ALWAYS_ON_MIN_API_LEVEL) { //only always-on feature triggers this + startWithForegroundNotification(); thread = new Thread(new Runnable() { public void run() { establishBlockingVpn(); @@ -221,7 +221,14 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat } public void startWithForegroundNotification() { - + notificationManager.createOpenVpnNotificationChannel(); + String message = getString(R.string.state_disconnected); + notificationManager.buildVoidVpnNotification( + message, + message, + eipStatus.getLevel(), + this::onNotificationBuild + ); } } -- cgit v1.2.3