diff options
| -rw-r--r-- | CHANGELOG.md | 4 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c410e9686..49e36a5b68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,10 @@ Line wrap the file at 100 chars. Th - Only reconnect when settings change if a relevant tunnel protocol is used. - Adjust padding of tray icon on Windows and Linux to better match other icons. +### Fixed +#### Android +- Fix crash when removing the service from foreground on Android versions below API level 24. + ## [2020.1-beta1] - 2020-02-05 ### Added 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 0a9a48e3fa..34ccb59bfd 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt @@ -207,7 +207,12 @@ class ForegroundNotificationManager(val service: Service, val connectionProxy: C service.startForeground(FOREGROUND_NOTIFICATION_ID, buildNotification()) onForeground = true } else if (!shouldBeOnForeground) { - service.stopForeground(Service.STOP_FOREGROUND_DETACH) + if (Build.VERSION.SDK_INT >= 24) { + service.stopForeground(Service.STOP_FOREGROUND_DETACH) + } else { + service.stopForeground(false) + } + onForeground = false } } |
