androidandroid-permissionsandroid-storageandroid-14

Is there any alternate of ACCESS_MEDIA_LOCATION permission to save images, seems it now comes with photo picker in android 14?


My app captures photos through/inside the app only, and saves it to \pictures\MyAppFolder. The app doesn't read/required to read any existing images, as it's not showing any image inside the app. So, to save images to phone storage I use ACCESS_MEDIA_LOCATION permission (for api > 28).

<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>

When I try to migrate the app to android 14, where upon runtime permission for ACCESS_MEDIA_LOCATION, it shows a prompt with photo picker (attached image). Which seems not ideal for my case (as my app doesn't fall in a category which gives an option to upload image to any server/service or make any use of the existing images, like for editing) to give a choice to pick/request access to any image.

Screenshot of the prompt

As the official document says that with ACCESS_MEDIA_LOCATION request, a permission named READ_MEDIA_VISUAL_USER_SELECTED will automatically added to an app's manifest which brings up the prompt/behavior for android 14. Thus it seems an expected behavior with android 14 (targetSDK 34)

So, now I am looking for any alternate permission which applies for my use case. Since it will be very confusing for the user to understand what and why any image they need to select from the prompt? And yes I believe I would not require MANAGE_EXTERNAL_STORAGE permission here. Also Google won't allow the same, as it won't fall to the appropriate use case.


Solution

  • As suggested by @CommonsWare to use MediaStore with this link. I found I was already having a method using MediaStore for android 10 and above. But I had also used ACCESS_MEDIA_LOCATION permission which was not required in my case, as I was just storing the image not reading them or any other images.

    So, I just removed the ACCESS_MEDIA_LOCATION permission and it worked for android 14 as well, without any image picker option in permission request prompt. Official Document covering the same.