diff --git a/android/app/src/main/kotlin/com/network/proxy/ProxyVpnService.kt b/android/app/src/main/kotlin/com/network/proxy/ProxyVpnService.kt index a523ba8..868bca4 100644 --- a/android/app/src/main/kotlin/com/network/proxy/ProxyVpnService.kt +++ b/android/app/src/main/kotlin/com/network/proxy/ProxyVpnService.kt @@ -159,7 +159,9 @@ class ProxyVpnService : VpnService(), ProtectSocket { .setOngoing(true) .build() - startForeground(NOTIFICATION_ID, notification) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { + startForeground(NOTIFICATION_ID, notification) + } } diff --git a/android/app/src/main/kotlin/com/network/proxy/plugin/PictureInPicturePlugin.kt b/android/app/src/main/kotlin/com/network/proxy/plugin/PictureInPicturePlugin.kt index 87d8c7c..8b94ff3 100644 --- a/android/app/src/main/kotlin/com/network/proxy/plugin/PictureInPicturePlugin.kt +++ b/android/app/src/main/kotlin/com/network/proxy/plugin/PictureInPicturePlugin.kt @@ -130,14 +130,14 @@ class PictureInPicturePlugin : AndroidFlutterPlugin() { val pIntent: PendingIntent = PendingIntent.getBroadcast( activity, if (isRunning) 0 else 1, - Intent(VPN_ACTION), + Intent(VPN_ACTION).apply { setPackage(activity.packageName) }, if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_IMMUTABLE else PendingIntent.FLAG_UPDATE_CURRENT ) val cleanIntent: PendingIntent = PendingIntent.getBroadcast( activity, 2, - Intent(CLEAN_ACTION), + Intent(CLEAN_ACTION).apply { setPackage(activity.packageName) }, if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_IMMUTABLE else PendingIntent.FLAG_UPDATE_CURRENT ) diff --git a/android/build.gradle b/android/build.gradle index 21abdae..5bb2bed 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -19,9 +19,24 @@ allprojects { rootProject.buildDir = '../build' subprojects { - afterEvaluate { - android { - compileSdkVersion 34 + afterEvaluate { project -> + if (project.extensions.findByName("android") != null) { + Integer pluginCompileSdk = project.android.compileSdk + if (pluginCompileSdk != null && pluginCompileSdk < 31) { + project.logger.error( + "Warning: Overriding compileSdk version in Flutter plugin: " + + project.name + + " from " + + pluginCompileSdk + + " to 31 (to work around https://issuetracker.google.com/issues/199180389)." + + "\nIf there is not a new version of " + project.name + ", consider filing an issue against " + + project.name + + " to increase their compileSdk to the latest (otherwise try updating to the latest version)." + ) + project.android { + compileSdk 31 + } + } } } }