0

As you all know 5th May is the deadline for using Scoped Storage for Android 11. And here's the case for: I have an app in which user uploads an image during the Sign Up process and I'm using this method to select an image from Gallery

 Intent chooseImageIntent = new Intent();
        chooseImageIntent.setType("image/*");
        chooseImageIntent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(chooseImageIntent, "Select image"), requestCode);

then

  @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        switch (requestCode) {
            case PICK_IMAGE_ID:


                // If image is selected successfully, set the image URI and bitmap.
                Uri imageUri = data.getData();
                mBitmap1 = ImageHelper.loadSizeLimitedBitmapFromUri(
                        imageUri, getContentResolver());


                if (mBitmap1 != null) {

                    ivItem1.setImageBitmap(mBitmap1);

                    uploadFile(mBitmap1, PICK_IMAGE_ID);
                } else {
                    Toast.makeText(this, "image not loaded", Toast.LENGTH_SHORT).show();
                }

                break;
          
            default:
                super.onActivityResult(requestCode, resultCode, data);
                break;
        }
    }

What changes should I make, in order to comply with the Android 11 update or storage policy update?

1 Answers1

0

It's mentioned in the Google's support website and I quote

Google Play restricts the use of high risk or sensitive permissions, including a special app access called All files access. This is only applicable to apps that target Android 11 (API level 30) and declare the MANAGE_EXTERNAL_STORAGE permission, which is added in Android 11. Also, this policy does not impact the usage of the READ_EXTERNAL_STORAGE permission.

So if you are requesting MANAGE_EXTERNAL_STORAGE permission on Android 11 then you need to remove it if it not required by your app. If you need that permission then you need to explain why you are using it.

Since you are asking only READ_EXTERNAL_STORAGE permission. You don't have to do anything. and the policy will not affect your app unless you are requesting MANAGE_EXTERNAL_STORAGE permission

More details can be found here : Preview: Use of All files access (MANAGE_EXTERNAL_STORAGE) permission

AgentP
  • 6,261
  • 2
  • 31
  • 52