-
-
Notifications
You must be signed in to change notification settings - Fork 895
Write permission not granted when requestion storage access. #642
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
Comments
I have the same problem, so I'd like to know the solution as well. |
I have the same problem, |
Hi @0x-cell, I tried to reproduce the same issue that you have on both Android 11 and Android 9. I Wrote the following code:
This made the folder named 'Test' in the Download folder, and only worked after requesting the On Android 10 it's a bit different, so I think @0x-cell and @Perrin666 and @kamlesh9070 you all have this issue on Android 10? For Android 10 users you should ask the
in your manifest, you also need I'll close this issue for now since I think this will solve your problems, but let me know if it did not so I can re-open the issue! |
Hi @JDDV, Thanks for the answer but unfortunately it's not working for me. I tested this on 3 separate emulators (Android 9, 10 and 11), but I get the same behavior every time. I tried it on my actual phone as well, but no luck either (MotoG8+ Android 10). This is my Android Manifest:
And the relevant code for storing the file:
The problem is with the writeAsBytes call. I get the following error there: Any idea what I am doing wrong? Thanks! |
@Perrin666 that's odd, I've tried to do it on Android 9, 10 and 11 with the code I've provided down here. I did use Code I used to test
It's the basic Flutter counter Application when you start a new Flutter Application project with a few extra methods.
And of course I added the lines needed for asking for the permission in the
This for me, as long as I don't debug, works for me (somehow debugging makes it not work). For your code, I don't see anything weird going on. I assume the code goes in the I assume you do get the I don't think updating to the newest version of the plugin, followed by a |
Hi @JDDV, Good thing you mentioned debugging, because that's exactly what I do. I will try out your suggestions withouth debugging and let you know the result. And to make sure: I indeed get the request dialog, and then I allow it. Update: I manage to run the standalone test app and write a file. So there must be something misconfigured in my code. Time to look deeper. Another update: I uninstalled the app, and started from scratch again, and now it works. Not sure what changed since the previous time, but I'm happy it works. And yet another update: it worked, now it suddenly no longer works. But the problem is clearly on my side, so I guess you can still close this issue. Thanks for the help! |
@Perrin666 yes I would say this problem is not something that has to do with the permission handler. Good luck with finding the problem, I hope you find it soon! |
Hi @JDDV, I managed to fix it by using getExternalStorageDirectory() (and getApplicationDocumentsDirectory() as a fall back) as a download directory instead of using /storage/emulated/0/Download. I'm still not sure why it works in your app, and not in mine, but it works like this, so I'm done messing with it :P Thanks for the help! |
I'm facing the same issue, it works on some devices and doesn't work on another devices, mostly Motorola. I think it's related to the path /storage/emulated/0/ we're using. I'd rather use path_provider for this instead of this hard-coded path, it seems that this PR will provide a download folder option on this plugin. |
🐛 Bug Report
When accepting permissions for storage access and then trying to create a folder in Documents directory I'm getting following error:
I'm using following request which I'm expecting both
read & write permissions
would be granted:As it turns out, it only grants read permissions:
And yes, i do have required permissions in my
AndroidManifest.xml
Expected behavior
Get
write access
when callingPermission.storage.request()
.Reproduction steps
Call
Permission.storage.request()
and create a folder in an external storage.Configuration
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1110], locale pl-PL)
Version: ^8.1.4+2
Platform:
The text was updated successfully, but these errors were encountered: