Aia with 500 (text) files in the assets / File.Exists_scope

There are some files because I did a lot of tests before. (But these are old files.)

Did you copy / save this file (in the folder /Download)?

If so, can you show the blocks?

EDIT: I checked it again. Yes, your test app creates this file.
So it should also be possible to save it in → /Documents.
Great! Thank you.

2 Likes

I am passing the path Documents as shown in blocks image, but it saves it to Download folder :sweat_smile:.

1 Like

What does that mean? Isn’t it possible to save / copy a non-media file in /Documents?
I think it should be possible.

Btw, shouldn’t the shared folders be → /Downloads (not → /Download)?

1 Like

This Scoped storage stuff is really confusing. :upside_down_face:

2 Likes

And why is the fileName “Documents_WooHoo.txt” and not only “WooHoo.txt” ?

grafik

(FileScope.Asset, "WooHoo.txt", FileScope.Shared, "/Documents/WooHoo.txt")

1 Like

Did you use the Storage Access Framework (SAF) to save (copy) the file?
I think so, but I want to be sure.

1 Like

I think it depends device by device, my device don’t even have Downloads folder, everything is saved in Download folder.

It’s same as of appinventor.

1 Like

My Android 11 test device (Pixel 2XL) initially didn’t have a folder /Downloads either, so I created it. Nevertheless, the text file is copied to /Download.

2 Likes

Maybe because device prefers that path instead of ‘Downloads’

1 Like

Ok, but then it shouldn’t make any difference what path I enter here (instead of /Documents or /Downloads), it is always saved in the /Download folder.
I think it shouldn’t be like that.

1 Like

I think that the MIT team is also struggling with this …
because we are still waiting for the targetSdkVersion = 30 update from AI2.

And there are still some issues and bugs on the AI2 test server.

Okay, it seems it’s working well and file is being stored in Documents folder, The issue was that toFileName cannot have slash in starting.

These are the current blocks :

Demo Apk -
FileTest (6).apk (4.6 MB)

Note - It seems non media files can only be stored in either Download folder or Documents folder or there will be a IOException.

2 Likes

Ahh … good to know.

Yes correct, I checked it.
Light comes slowly into the darkness. :grinning:
Thank you very much!

1 Like

Last question:
Why does this crash on the AI2 test server (Companion & APK)?
So what did you need to fix it?

1 Like

Appinventor is crashing probably because their code is incomplete, They are probably still working on it

2 Likes

Just for your information:

And sorry, but another question:
How it is possible that this (APK) works without using any method regarding “shared storage” (FileScope.Shared): testFileApi30.apk (3.3 MB) (→ built on the AI2 test server).

Blocks

Steps to test the app (especially on Android 10 and 11):

  1. Install the APK and test … it will work.
  2. Unistall and reinstall it. Now it does no longer work.
  3. Then check the CheckBox and try again … it should work again …

I tested this APK on a Pixel 2XL (Android 11).

See also here:

Btw, same behavior with Niotron:

I imported the AIA and built the APK.
testFileApi30_Nio.apk (4.6 MB)

I am not sure what’s the issue here
I installed the app in a device with Android 10, file saving works well and after uninstalling and reinstalling it seems to work well without checking the checkbox, just count resets as tinydb data would be cleared.

Try to remove the created (saved) text files from /Download and /Documents.
(I did this via USB connection from my computer.)
Then it should no longer work without checking the CheckBox.

Okay, just tried
Still working without any issue​:sweat_smile: