Commit 68f4a051 by k18coldwl Committed by GitHub

Fixed the WRITE_EXTERNAL_STORAGE permission may not request on Android Q or…

Fixed the WRITE_EXTERNAL_STORAGE permission may not request on Android Q or higher which configuring targetSDK <=29 and externalStorageLegacy = true (#765)

Co-authored-by: k18cold <k18cold@163.com>
parent abdd201a
......@@ -193,7 +193,7 @@ public class PermissionUtils {
if (hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_EXTERNAL_STORAGE))
permissionNames.add(Manifest.permission.READ_EXTERNAL_STORAGE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q && Environment.isExternalStorageLegacy())) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.Q && Environment.isExternalStorageLegacy())) {
if (hasPermissionInManifest(context, permissionNames, Manifest.permission.WRITE_EXTERNAL_STORAGE))
permissionNames.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment