summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
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)