-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fileprovider fails to open file with write permission #19722
Comments
Hi there. Android 11 introduced changes to how applications handle files. Applications have a reserved directory where they can create or read files. If you want to read or open files outside of the reserved directory, you need to declare the MANAGE_ALL_FILES permission in the manifest. Read more here: |
my application already declare MANAGE_ALL_FILES, in fact the application write file inside the shared /documents folder of the system (the one reachable from every app, i can use a folder explorer to view the file even without my app) |
i've tagged this issue as a bug because i think i'm using the right Intent command and maybe there is something inside MAUI that doesnt work as expected. if not i could use some help to refind the Intent command. |
Typically you would use the Launcher API to launch the apropriate app for the file extension. If the problem is that you can't save the changes from the external Excel app that is not related to MAUI. |
the laouncher API documentation for open file with third party app write:
so i avoided it because i need to open and edit the file. |
I would search the documentation of the Excel app you are using. Maybe you need to invoke some Uri. It is very likely newer versions of Android are causing what you describe due to new security restrictions. |
i've follow many online resoruces, the file uri seems correct "content://my.software.app/documents/file.xlsx" (in fact the file can be viewed). |
Description
hi, i'm building an app that download and store file inside the android file system (into a subfolder of /documents).
after downloading it i need to open selected file with the best aviable app (ex: if a file has .xlsx extension it should open with excel app) and into the app it should be able to modify and save in the same path.
the problem is that if my application target the sdk v33 the file opens but it remanin in what it seems read-only mode because if the user try to save the changes excel promt to the "save as" tab.
instead if my application target sdk less then 24 i could open the file without using the file provider (and it opens with write permission and i can save the changes).
whta i'm missing to use the 33sdk and the file provider?
Steps to Reproduce
Crate maui app
add this code to the androidmanifest:
the file opens but it seems readonly
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
android sdk 33
Did you find any workaround?
there is a workaround:
intent.SetDataAndType(Android.Net.Uri.FromFile(file), mimeType);
Relevant log output
No response
The text was updated successfully, but these errors were encountered: