diff --git a/app/build.gradle b/app/build.gradle index 0595de9a..5f43cf6f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,9 +5,9 @@ android { defaultConfig { applicationId "com.emanuelef.remote_capture" - compileSdk 33 minSdkVersion 21 - targetSdkVersion 33 + compileSdk 34 + targetSdk 34 versionCode 71 versionName "1.6.8" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5c46d3ee..bb1b48d6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ + @@ -114,7 +115,12 @@ + + + diff --git a/app/src/main/java/com/emanuelef/remote_capture/CaptureService.java b/app/src/main/java/com/emanuelef/remote_capture/CaptureService.java index 23cdafee..f785f3c4 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/CaptureService.java +++ b/app/src/main/java/com/emanuelef/remote_capture/CaptureService.java @@ -31,6 +31,7 @@ import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.pm.ServiceInfo; import android.net.ConnectivityManager; import android.net.LinkProperties; import android.net.Network; @@ -220,7 +221,10 @@ public int onStartCommand(@Nullable Intent intent, int flags, int startId) { // NOTE: since Android 12, startForeground cannot be called when the app is in background // (unless invoked via an Intent). setupNotifications(); - startForeground(NOTIFY_ID_VPNSERVICE, getStatusNotification()); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) + startForeground(NOTIFY_ID_VPNSERVICE, getStatusNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE); + else + startForeground(NOTIFY_ID_VPNSERVICE, getStatusNotification()); // NOTE: onStartCommand may be called when the capture is already running, e.g. if the user // turns on the always-on VPN while the capture is running in root mode