diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-05-04 18:17:48 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-05-04 19:47:47 +0000 |
| commit | ce064344367900134c9d14a6f96ac5ebdd30a790 (patch) | |
| tree | 3c22377dc085d3fa023fd119496a0022aa00fe49 /android/src | |
| parent | 2e3d52901f7304387c18ce28cecba06f5d8af5f0 (diff) | |
| download | mullvadvpn-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.kt | 9 |
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) |
