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

Fix file system access on android 13 + #13

Closed
Rory-Reid opened this issue Apr 26, 2023 · 4 comments
Closed

Fix file system access on android 13 + #13

Rory-Reid opened this issue Apr 26, 2023 · 4 comments
Labels
android A thing that affects android bug Something isn't working

Comments

@Rory-Reid
Copy link
Owner

Rory-Reid commented Apr 26, 2023

Looks like one user might be affected by a possible bug in MAUI on android 13. It looks like Android 13 changes some stuff around how file system access permissions work and as a result, the framework just doesn't handle it right.

Seems to be that it simply does not ask for permissions to use the file system on-demand. Might have to request these permissions up front or maybe declare a fallback API until there's an official fix?

See:

@Rory-Reid Rory-Reid added bug Something isn't working android A thing that affects android labels Apr 26, 2023
@Rory-Reid
Copy link
Owner Author

The above implies that the issue was resolved and hotfixed in dotnet 7, as well as upcoming in 8. This means an SDK and maui workflow update should resolve this for me.

I've updated both locally, I just need to publish a build with the new framework and confirm if the issue is resolved for affected users.

@Rory-Reid
Copy link
Owner Author

Building with the latest version appears to have got past the initial issue, but frustratingly now the user is not being prompted to choose a file location whatsoever, and files are just saving in some random directory.

@Rory-Reid
Copy link
Owner Author

So, broadly this is a bigger issue than "Microsoft forgot to do something". Android 13 comes with API 33 which introduces significant privacy/security based tightening of the external file access permissions. The two permissions I use, as expected by MAUI CommunityToolkit, are READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE.

Android have changed these to do nothing now, and the only one that works is MANAGE_EXTERNAL_STORAGE but that requires special permission from google to let your app use that if you want to publish on the android store.

I might be able to make a justification but it might also be the case that using the Storage Access Framework gives me what I need here instead. The issue is I use the Community Toolkit to handle file saving, and AFAICT that does not have a means of using that.

@Rory-Reid
Copy link
Owner Author

Found the MAUI Share API which works for me

Fixed in 3e38d8b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android A thing that affects android bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant