From 30d7f799bbe0a9b21230f6b65796e34a650bad2f Mon Sep 17 00:00:00 2001 From: KAAAsS Date: Sat, 16 Sep 2023 21:57:08 +0800 Subject: [PATCH] fix: Toast not shown when network is connected in MIUI (#57) --- app/src/main/AndroidManifest.xml | 1 + .../zerotierfix/service/ZeroTierOneService.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4ade57c..77d48d6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ + = 23) { + pendingIntentFlag |= PendingIntent.FLAG_ONE_SHOT; + } + if (Build.VERSION.SDK_INT >= 31) { + pendingIntentFlag |= PendingIntent.FLAG_IMMUTABLE; + } var pendingIntent = PendingIntent.getActivity(this, 0, - new Intent(this, NetworkListActivity.class), - Build.VERSION.SDK_INT >= 23 - ? PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT - : PendingIntent.FLAG_UPDATE_CURRENT); + new Intent(this, NetworkListActivity.class), pendingIntentFlag); var notification = new NotificationCompat.Builder(this, Constants.CHANNEL_ID) .setPriority(1) .setOngoing(true)