From acaea89eb6d15b431e8ea96db6fa57f14bd86217 Mon Sep 17 00:00:00 2001 From: Thomas BESSOU Date: Thu, 8 Aug 2024 16:49:51 +0200 Subject: [PATCH] Don't break on auto-refusal of Storage permissions on high Android versions --- .../activities/tools/LoginActivity.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apprts/src/main/java/com/rfidresearchgroup/activities/tools/LoginActivity.java b/apprts/src/main/java/com/rfidresearchgroup/activities/tools/LoginActivity.java index c1dd6b5a..7967df4d 100644 --- a/apprts/src/main/java/com/rfidresearchgroup/activities/tools/LoginActivity.java +++ b/apprts/src/main/java/com/rfidresearchgroup/activities/tools/LoginActivity.java @@ -96,11 +96,13 @@ public void onPermissionNormal(PermissionUtil util) { }); ArrayList permissionArray = new ArrayList<>(); - Collections.addAll(permissionArray, - // 以下是一定要添加的权限 - Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.READ_EXTERNAL_STORAGE - ); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { + Collections.addAll(permissionArray, + // 以下是一定要添加的权限 + Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.READ_EXTERNAL_STORAGE + ); + } // android 12或者以上,要单独申请蓝牙权限 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {