Can't search and save csv files? - File component - FileScope (Android11)

And I also want to ask, if I use Emulator to run my program, can I find my ASD too?

I didn't get any error message. The reason of I thought that is because the CSV file doesn't update after I run my program.

Use Companion on your phone. To be really sure you are getting it right, build an APK. You can use an AfterFileSaved Block to verify that the Append happened. Also, follow the link I gave you to learn about Android Shared folders. There is an excellent diagram by Anke that shows what you can and cannot do. Note, you only need to use Append - if the file doesn't exist, Append will create it.


Please let us know which DefaultFileScope and which FileScope you are using.
And post the aia or a small test aia.

Are you saying, you store that file manually somewhere outside of your app? Probably in shared storage? How and where exactly?

See again Some basics on Android storage system

To edit non media files, which are not owned by your app you will need SAF


Btw, the Properties of the File component (DefaultScope) should have the same name as the block:



Sorry here is my test aia. But I still can't sand the data into my csv file(in my Phone) :disappointed_relieved:. Please tell me what the problem in my aia. :disappointed_relieved:
ARMCSV (1).aia (7.3 KB)

Show your blocks.

Note: On Android 11+ you can save non-media files only in the ASD or one of the Shared folders (/Documents or /Download), but not in the root dir of the external storage or any other arbitrary folder.

Here is my block.

Jasper, you have not studied the Guide even though both myself and Taifun asked you to. We are here to help you help yourself, not to write your code for you.

Try this on your phone as an APK:
SaveShared.aia (4.3 KB)

Sorry to ChrisWard, I have read all the links you and Taifun sent me, and I try to modify my aia but it still didn’t work...So I sent my block hope somebody can give me some advice :disappointed_relieved:

Try the file I uploaded - build an APK.

Did you try my blocks? Post → #17

1 Like

Yes but it still have an error and finally I find the problem :sob: :sob:
I need to change DefauultFileScope to Legacy, thanks to guys help :slightly_smiling_face:

This should only be needed for the APK, but it should work with Companion.

And to avoid storage permissions on Android 11+ you can also use my MFile extension, which does not request storage permissions on Android 11+.

OK , thank for your sharing, Anke :+1: :+1:

Note: → StorageFile component→ FileScope → Legacy
"Legacy: Files will be read from and written to the file system using the App Inventor rules prior to release nb187. That is, file names starting with a single / will be read from and written to the root of the external storage directory, e.g., /sdcard/. Legacy functionality will not work on Android 11 or later."

This is imprecisely (incorrectly) formulated. It should have been said that with Legacy (or any other FileSpope) it is not possible to write to or read from

  • the root directory or
  • an arbitrary folder.

So in other words, a non-media file can only be written to one of the Shared folders (/Download or /Documents) on Android 11+ (when using a slash at the beginning).

The only difference between

  • FileScope = Shared and
  • FileScope = Legacy

is that Legacy can also write to the Private directory (internal storage) if the file name starts without a slash (eg file.txt).