How to request and grant MANAGE_EXTERNAL_STORAGE permission

Hey sorry for late writing, this is my first posting.. I read about but with android 11 and the original appinventor2 v 30, by setting legacy, even only in the blocks, I can copy a file from public directories (/Downoad/any/) to private app space and viceversa. But but, when I build my app apk it cannot access anymore, denied access to external storage ecc. It is not a filename problem, it seems a permission problem. Setting it in screen1 designer also dont work. Apparently the apk has multimedia write/read premission... the file is a simple text csv file..
Before going crazy, is there a possibility for an apk built by appinventor2 v30 for android11 to copy a text files to/from public storage?

sorry for my preceeding posting, just now I found the tutorial Some basics on Android storage system - #13 by Anke and probaly understood why under appinventor share access worked, and the fact that read access to shared folder is free granted only for files created by the app (appinventor..)
boh.. are not these limitations rather excessive?..just to import some list into an app is a pain..

Yes thank you! Now i have to check deleting appinventor created files in the shared dir (/Download/..) because they could deny access to the same files from the apk which is a different app!

1 Like

there's something wrong... according to your https://community.appinventor.mit.edu/uploads/default/original/3X/4/0/40cd49dd497957af9973789392bc0b679d1ca8f6.jpeg I should not need any permission to write and read a text file generated by the app from /Download. In fact testing under appinventor it does ok!
Building the apk, when reading if there is no file, the app stops telling "file not found" but if I hand copy the file into /Download it stops telling "no permission.."; and that's also ok.
But when writing the text file in /Download (where is not yet present) the apk stops, telling "no external storage permission granted ..etc" ; that's not good, I should not need any permission to do that so why this message?
Furthermore, the scope should only set the default base locations, on android 11.. You said to set screen 1 scope to share or legacy, but apart setting the correct path (which in my test is ok) I don't need any permission..
So, I fear it is the appinventor builder itself (and not android 11) which is forbidding.. As said, under appinventor testing I can perfectly write and read the files from /Download


you found one of the bugs of the file component
@ewpatton my guess is, this bug is already on the bug list of the file component?
@roby_nooorano you might want to use

Taifun

1 Like

If not, my countless reports on this bug would not only have been unsuccessful, but would have been a complete waste of time.

In my app I need to share a csv data file from my mobile to other mobiles, pc etc, each of them can edit the csv. While exporting from my app can be done by share (and e.g telegram) loading is a problem also without the bug, read/write external is needed. I'm novice to android so tried to edit with apk-editor without success.. such tired I decided to import file by using tiny http server and the ai web component, because they strongly control that I cant import anything not mine from the filesystem, but I can eat anything from the net (or simply localhost..). Not elegant but for what I need i t works

sorry .. in the blocks, it was the visible TextBox3.Text which was actually used for input the field with the server, port and directory..

in this case the correct way would be to use the SAF extension, which is able to read text files created by others than the app itself

see also the overview

Taifun

thank you I will look the extension, a great piece of work, it seems rather more complex than the file component.. at worst I'll simply load from the net

I want to thank you for SAF suggestion and of course for vknow360; you can see my blocks, well for my usage SAF worked "..rather.." smootly, under both ai and apk.

...unclear to me why in document creation, to set the parent document uri, I had to make two calls with the same only uri param to get what seems the parent of the directory (and not the document) in which the file is created.. without vknow360 example I would never guessed..

1 Like

Hello,

I'm trying to replicate the blocks for MANAGE_EXTERNAL_STORAGE permission, but I can't find Allfilepermission1.sdkversion.
What is the type of Allfilepermission? media...?
I only have '...'.scope.
I made the change (I think) in Designer.
How to find it?
Thanks

Did you drag the extension into your app in the designer?
If so, go to the blocks and you will find it.

I'm looking at the .aia and I'm just trying to get the extension.
Is it the .aix file?

Edit : ok, I find it ! Thanks

Can you confirm that with this extension, the file cannot be modified (I can read it)?
Thanks

What about trying? But yes, you can write to / read from every file in all locations (of the external storage).

I'm still trying to change a file in /Download.
But I'm also looking at how to download it from the application, it will be easier

After that copy / move the file to /Download.

Dear Anke,
i've been stuck trying to make my app work on the new device, and gut stuck in the permission issue for a looong time,
you made me happy today!
Thank you

1 Like