Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always return Granted for Read-Write Storage permissions on Android #23909

Merged
merged 5 commits into from
Sep 3, 2024

Conversation

jfversluis
Copy link
Member

@jfversluis jfversluis commented Jul 30, 2024

Description of Change

The android.permission.READ_EXTERNAL_STORAGE and android.permission.WRITE_EXTERNAL_STORAGE permissions are no longer available on Android 13 (API 33) and up. This PR changes the current .NET MAUI implementation to not change anything for < API 33, and always returns granted for API 33+.

If you want to access specific media files, you now need to request specific permissions for that. This PR don't implement those yet. For the time being you can implement those manually if you need them, following this documentation here: https://learn.microsoft.com/dotnet/maui/platform-integration/appmodel/permissions?tabs=android#extending-permissions.

Issues Fixed

Fixes #14729

@jfversluis jfversluis added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Jul 30, 2024
@jfversluis jfversluis requested a review from mattleibow July 30, 2024 08:26
@jfversluis jfversluis requested a review from a team as a code owner July 30, 2024 08:26
@jfversluis jfversluis requested a review from Eilon July 30, 2024 08:26
@jfversluis
Copy link
Member Author

I know this has new APIs but it seems that this is important/blocking enough to bring this back to .NET 8 servicing?

@bijington
Copy link

Will there be an expectation to support mapping to the new more granular Android permission?

If your app targets Android 12 or lower, you must request the READ_EXTERNAL_STORAGE permission. If your app targets Android 13 or higher and needs access to files that other apps have created, you must request one or more of the following granular permissions instead of the READ_EXTERNAL_STORAGE permission:

  • READ_MEDIA_IMAGES
  • READ_MEDIA_VIDEO
  • READ_MEDIA_AUDIO

Quote from this article:

https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/storage/file-picker?view=net-maui-8.0&tabs=android

@jfversluis
Copy link
Member Author

jfversluis commented Jul 31, 2024

Will there be an expectation to support mapping to the new more granular Android permission?

If your app targets Android 12 or lower, you must request the READ_EXTERNAL_STORAGE permission. If your app targets Android 13 or higher and needs access to files that other apps have created, you must request one or more of the following granular permissions instead of the READ_EXTERNAL_STORAGE permission:

  • READ_MEDIA_IMAGES
  • READ_MEDIA_VIDEO
  • READ_MEDIA_AUDIO

Quote from this article:

https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/storage/file-picker?view=net-maui-8.0&tabs=android

Yeah as mentioned in the opening post, I think people should be able to manage on their own by implementing these permissions if they need them right now while we get to it. There is this issue to track the implementation of the new media permissions: #12857. This just focusses on unblocking the missing READ_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE permissions for API 33+

@jfversluis
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@mattleibow mattleibow merged commit 31ed71f into main Sep 3, 2024
97 checks passed
@mattleibow mattleibow deleted the fix-14729 branch September 3, 2024 14:25
@samhouts samhouts added fixed-in-net9.0-nightly This may be available in a nightly release! fixed-in-net8.0-nightly This may be available in a nightly release! labels Sep 5, 2024
@samhouts samhouts added fixed-in-9.0.0-rc.2.24503.2 and removed fixed-in-net9.0-nightly This may be available in a nightly release! fixed-in-net8.0-nightly This may be available in a nightly release! labels Oct 14, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info fixed-in-9.0.0-rc.2.24503.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ANDROID] Requesting Read-Write External Storage in .net 7 not working
4 participants