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?