Saving and reading files with android 11

Sorry to post this again but my app cannot save or read data from a file anymore. it worked in android 8.
i tried andreas' saveToShared.aia but get the error.

"runtime error
Error from companion: the operation DefaultFileScope cannot accept the arguments: , ["Legacy"]
"
i did not change any block.

i still use the taifun File extension from 2019 because i do not know how to upgrade teh extension. when i try import the newer one it says something like "duplicate...."
any help is highly appreciated

thanks
Erhard

If your app is only intended for private use or for special users or for other app stores you can see here How to request and grant MANAGE_EXTERNAL_STORAGE permission

Please always post a link to it (and "if possible", spell the (my) name correctly ("Anke"):

This test aia works fine.

Try also this test app (and follow the notes): saveToShared_2.aia (3.0 KB)

Non-media file that are saved in one of the Shared folders (/Documents or /Download) MUST be created by the app itself. The APK and the Companion app are different apps. So the text file must be removed before testing (with Companion or APK beforehand).

See also here:

2 Likes

And a final note, which I have made countless times in other places:
The File component incorrectly requests storage permissions even for the Shared folders.

This is of course a bug on Android 11+ !

2 Likes

To avoid storage permissions on Android 11+, you can do so using Sunny's EFile (@vknow360) and @Taifun's TaifunFile extensions.

2 Likes

first let me apologize for mixing up your name Anke, will not happen again.
thank you all for the quick input you provided.

now i am using taifunFile extension from 2019 and would have thought that the newer version would handle the android11 situation transparent to the user but maybe not. Again i also cannot figure out how to upgrade to the latest TaifunFile extension, would it help?

Anke while typing all this it just dawned to me that actually said COMPILE the app. i missed this because it never was an issue in android8.
good news is that the compiled app WORKS :slight_smile:

so does that now mean during development phase i cannot test file operations as was possible in android 8? that would be a bummer.

Patel i will also look into your suggestion - thanks.

good news is with your help i can continue with my work -
thanks a lot
erhard

A post was split to a new topic: Taifun Screenshot not working (for me)

hm this is super frustrating please help. based on your suggestions i added the following to my first screen
image

and i get the error 908 ....write external storage...
i did give permission in the settings screen of the app but error still shows. as much as i like appinventor but this is really very difficult. Taifun in another thread also mentions the issue with multiple screens, which i have. i never had any issues in android 8.
i am not sure what else to try.

thanks in advance

erhard

This is a common error; please search the community before posting.

sorry but i did try several hours before i posting, but thanks for the hint.
anyway i found that hint to set the first screen filescope to LEGACY - i have not seen this mentioned anywhere before.
and i found the file in INTERNAL memory.
so even i give permission to EXTERNAL it is now in internal memory. simply beyond my mental capacity now

1 Like

Why don't you try my test app?
Everything is set up there so that it works on all Android versions.

DefaultFileScope = Legacy (→ Designer)
saveToShared_2.aia :

I tested your app saveToShared_2.aia, when I clic on save button the app stops with filescope shared, runs good with filescope legacy. (Android11)

As I've shown (above):

1 Like

I tested it with 11

Companion or APK?

It works on Android 11 and 12 (also with Shared).

Companion, I did not build it

What does "the app stops" mean?
Take a screenshot ...

I can not, the app closes itself with companion.
I tried apk with shared, it runs well.
With companion 2-62u no problem with shared

Which companion version did you test with before?

grafik