diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java b/src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java
index b6e7e2d64..d573d882d 100644
--- a/src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java
+++ b/src/frontends/android/app/src/main/java/org/strongswan/android/logic/CharonVpnService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017 Tobias Brunner
+ * Copyright (C) 2012-2018 Tobias Brunner
* Copyright (C) 2012 Giuliano Grassi
* Copyright (C) 2012 Ralf Sager
* HSR Hochschule fuer Technik Rapperswil
@@ -19,6 +19,7 @@ package org.strongswan.android.logic;
import android.annotation.TargetApi;
import android.app.Notification;
+import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
@@ -70,6 +71,7 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
{
private static final String TAG = CharonVpnService.class.getSimpleName();
public static final String DISCONNECT_ACTION = "org.strongswan.android.CharonVpnService.DISCONNECT";
+ private static final String NOTIFICATION_CHANNEL = "org.strongswan.android.CharonVpnService.VPN_STATE_NOTIFICATION";
public static final String LOG_FILE = "charon.log";
public static final int VPN_STATE_NOTIFICATION_ID = 1;
@@ -162,6 +164,8 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
/* the thread is started when the service is bound */
bindService(new Intent(this, VpnStateService.class),
mServiceConnection, Service.BIND_AUTO_CREATE);
+
+ createNotificationChannel();
}
@Override
@@ -321,6 +325,25 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
stopForeground(true);
}
+ /**
+ * Create a notification channel for Android 8+
+ */
+ private void createNotificationChannel()
+ {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
+ {
+ NotificationChannel channel;
+ channel = new NotificationChannel(NOTIFICATION_CHANNEL, getString(R.string.permanent_notification_name),
+ NotificationManager.IMPORTANCE_LOW);
+ channel.setDescription(getString(R.string.permanent_notification_description));
+ channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
+ channel.setShowBadge(false);
+ NotificationManager notificationManager = getSystemService(NotificationManager.class);
+ notificationManager.createNotificationChannel(channel);
+ }
+ }
+
+
/**
* Build a notification matching the current state
*/
@@ -336,7 +359,7 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
{
name = profile.getName();
}
- android.support.v4.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL)
.setSmallIcon(R.drawable.ic_notification)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
.setVisibility(publicVersion ? NotificationCompat.VISIBILITY_PUBLIC
diff --git a/src/frontends/android/app/src/main/res/values-de/strings.xml b/src/frontends/android/app/src/main/res/values-de/strings.xml
index 896e53608..975686e56 100644
--- a/src/frontends/android/app/src/main/res/values-de/strings.xml
+++ b/src/frontends/android/app/src/main/res/values-de/strings.xml
@@ -29,6 +29,8 @@
Laden…
Profil nicht gefunden
strongSwan-Verknüpfung
+ VPN Verbindungsstatus
+ Zeigt Informationen zum Verbindungsstatus der VPN Verbindung und dient als permanente Notification dazu, den VPN Dienst im Hintergrund am Laufen zu halten.
Log
diff --git a/src/frontends/android/app/src/main/res/values-pl/strings.xml b/src/frontends/android/app/src/main/res/values-pl/strings.xml
index ce1dc6741..835efd531 100644
--- a/src/frontends/android/app/src/main/res/values-pl/strings.xml
+++ b/src/frontends/android/app/src/main/res/values-pl/strings.xml
@@ -29,6 +29,8 @@
Wczytywanie…
Nie znaleziono profilu
Skrót strongSwan
+ VPN connection state
+ Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.
Log
diff --git a/src/frontends/android/app/src/main/res/values-ru/strings.xml b/src/frontends/android/app/src/main/res/values-ru/strings.xml
index 756473b56..53e837573 100644
--- a/src/frontends/android/app/src/main/res/values-ru/strings.xml
+++ b/src/frontends/android/app/src/main/res/values-ru/strings.xml
@@ -26,6 +26,8 @@
Загрузка…
Профиль не найден
Ссылка на strongSwan
+ VPN connection state
+ Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.
Журнал
diff --git a/src/frontends/android/app/src/main/res/values-ua/strings.xml b/src/frontends/android/app/src/main/res/values-ua/strings.xml
index 8c165734a..8e41daf91 100644
--- a/src/frontends/android/app/src/main/res/values-ua/strings.xml
+++ b/src/frontends/android/app/src/main/res/values-ua/strings.xml
@@ -27,6 +27,8 @@
Завантаження…
Профіль не знайдено
strongSwan посилання
+ VPN connection state
+ Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.
Журнал
diff --git a/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml b/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml
index 2d195f638..0cb6bd087 100644
--- a/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml
+++ b/src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml
@@ -26,6 +26,8 @@
载入中…
未找到配置
strongSwan快捷方式
+ VPN connection state
+ Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.
日志
diff --git a/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml b/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml
index 650cd6940..168fdd7dd 100644
--- a/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml
+++ b/src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml
@@ -26,6 +26,8 @@
載入中…
沒有找到設定檔
strongSwan快速選單
+ VPN connection state
+ Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.
日誌
diff --git a/src/frontends/android/app/src/main/res/values/strings.xml b/src/frontends/android/app/src/main/res/values/strings.xml
index e6cb9dc4c..13d718733 100644
--- a/src/frontends/android/app/src/main/res/values/strings.xml
+++ b/src/frontends/android/app/src/main/res/values/strings.xml
@@ -29,6 +29,8 @@
Loading…
Profile not found
strongSwan shortcut
+ VPN connection state
+ Provides information about the VPN connection state and serves as permanent notification to keep the VPN service running in the background.
Log