summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-05-04 18:17:48 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-05-04 19:47:47 +0000
commitce064344367900134c9d14a6f96ac5ebdd30a790 (patch)
tree3c22377dc085d3fa023fd119496a0022aa00fe49 /android/src
parent2e3d52901f7304387c18ce28cecba06f5d8af5f0 (diff)
downloadmullvadvpn-ce064344367900134c9d14a6f96ac5ebdd30a790.tar.xz
mullvadvpn-ce064344367900134c9d14a6f96ac5ebdd30a790.zip
Promise service is foreground in notification
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt
index 97a7e6b99e..bae29762e6 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt
@@ -265,8 +265,13 @@ class ForegroundNotificationManager(
private fun buildTunnelAction(): NotificationCompat.Action {
val intent = Intent(tunnelActionKey).setPackage("net.mullvad.mullvadvpn")
- val pendingIntent =
- PendingIntent.getBroadcast(service, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT)
+ val flags = PendingIntent.FLAG_UPDATE_CURRENT
+
+ val pendingIntent = if (Build.VERSION.SDK_INT >= 26) {
+ PendingIntent.getForegroundService(service, 1, intent, flags)
+ } else {
+ PendingIntent.getService(service, 1, intent, flags)
+ }
val icon = tunnelActionIcon
val label = service.getString(tunnelActionText)