summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt8
2 files changed, 11 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 95ab05671e..1ed5ec05f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,10 @@ Line wrap the file at 100 chars. Th
## [Unreleased]
+### Fixed
+#### Android
+- Fix crash when that happened sometimes when the app tried to start the daemon service on recent
+ Android versions.
## [2020.5-beta1] - 2020-05-18
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt
index 524d4ab00d..2bbd439325 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt
@@ -3,6 +3,7 @@ package net.mullvad.mullvadvpn.ui
import android.app.Activity
import android.content.ComponentName
import android.content.Intent
+import android.os.Build
import android.os.Bundle
import android.os.IBinder
import android.support.v4.app.FragmentActivity
@@ -85,7 +86,12 @@ class MainActivity : FragmentActivity() {
val intent = Intent(this, MullvadVpnService::class.java)
- startService(intent)
+ if (Build.VERSION.SDK_INT >= 26) {
+ startForegroundService(intent)
+ } else {
+ startService(intent)
+ }
+
bindService(intent, serviceConnectionManager, 0)
}