android 14

This commit is contained in:
wanghongenpin
2024-08-27 00:20:02 +08:00
parent 7b89af1401
commit fd663dc61b
3 changed files with 23 additions and 6 deletions

View File

@@ -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)
}
}

View File

@@ -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
)