ACCESS_MEDIA_LOCATION permission request is not showing prompt

3.6k views Asked by At

I've set my app to target AP 29 and removed requestLegacyExternalStorage=true from manifest.

Now I'm checking if the user has this permission and if result is denied I request for permission.

My problem is that the request for permission is returning Granted without showing the prompt... I know the flow is working since I'm able to read the GPS location from picture after being granted.

I see permission status = Denied and as soon as I explicitly request this permission, it returns Granted without any user interaction.

Eveything looks OK but I'm confused about not seeing the prompt... is this expected? I saw this permission qualifies as "Dangerous" so I was expecting a prompt. I'm testing on a Android 10 device.

I'm not showing any code since the project is Xamarin and the permission logic is handled through a third party library, don't think my code will help as the platform logic to request the permission is hidden by the component.

1

There are 1 answers

0
Nicolas Raoul On

From Android 10: fetch the gallery via MediaStore with location information :

This requires holding the ACCESS_MEDIA_LOCATION permission. Note, this permission is not "user visible in the settings UI" (source), which means the user won't see a popup asking for permission, even though it is a runtime permission. This means you have to ask for permission during runtime (in contrast to just the manifest file) but the user won't have to consent to it. Adding this here because you might be wondering why no extra UI popups are shown.

I'm still getting my head around the logic though. I'm in favour of the user being asked for permission but I don't understand why it should be necessary to "request" it if the user doesn't actually grant permission.

I was able to reproduce the issue in a simpler app. I have posted a slightly different question with code snippets.


This is an answer by HilaryN that I believe should not have been deleted (I removed the off-topic bits).