-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make MediaPicker capture methods work in Android 13+ #12766
Conversation
Hey there @Ghostbird! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Thanks for this PR, just doing some tests now as permissions on android is ... interesting. And yeah, we need to investigate these permissions. We are doing several things different since we first wrote this code. I see now we are passing in locations that the media should be stored, and in my testing some OS versions did not even need any read/write permissions. But for now to fix this, this PR is geat! |
@mattleibow What do I need to do to get this merged? |
Nothing more. Just want to get another review on this just in case. Android permissions are always a bit sketchy, but I will get this merged hopefully today. |
I still can't merge. I need 1 approving review. |
@mattleibow Should I maybe rebase this on |
In Android 13+ android.permission.WRITE_EXTERNAL_STORAGE no longer exists, and requesting it always returns `Denied`. AFAIK it is not needed for the media capture in this Android version either, though I may be wrong.
Never mind, it looks all right after all. I haven't actually managed to set-up my environment to successfully build MAUI, so I'm flying half-blind here. |
/azp run |
looks like this is more green :) |
Azure Pipelines successfully started running 2 pipeline(s). |
/backport to net7.0 |
Started backporting to net7.0: https://github.com/dotnet/maui/actions/runs/4011569003 |
When will this fix be available via nuget packages? |
@Ghostbird I am currently working on updating an old Xamarin Native app to MAUI and ran into this issue. Should we instead check for version 29 when asking for According to the android documentation, you do not need to request these permissions when writing to the application cache directories which the media picker does use. |
I only did the very minimum fix required to make this work. Note that it just barely missed the latest service release, so it'll be in next month's. At the moment I simply build using API 32, which is a workaround detailed in the original issue #11275 |
Description of Change
In Android 13+ android.permission.WRITE_EXTERNAL_STORAGE no longer exists, and requesting it always returns
Denied
. AFAIK it is not needed for the media capture in this Android version either, though I may be wrong.This PR is created to make at least some progress towards solving #11275. Because currently there's no way to get the MediaPicker.Capture functions working on Android 13.
My apologies, this is a bit of a cruddy PR, but since the issue has been open since November, and it seems no-one has made progress on it, I'm trying. If this PR is unsuitable, I hope it at least gets some attention to the issue. It is really annoying that MAUI builds Android API 33 by default, but the current MediaPicker capture code can never work on Android API 33.
I looked at Permissions.android.cs and I think the storage read and write permission there are overdue a rewrite. The code there is 100% incompatible with Android 13 / API 33 which MAUI is meant to support. However, I don't know enough about the code base to make such rigorous changes, so I hope someone will look at that soon.
Issues Fixed