Some basics on Android storage system

I understand. Can this file explorer move files, folders, rename, edit text files?

Yes, it does use the default text editor though.

I think the question here should be, how to save and access files from the (AI2) app when AI2 is targeting API 30 (targetSdkVersion = 30).

2 Likes

Hello,
Before the update we used to use the following paths:

  1. Companion: file:///mnt/sdcard/AppInventor/assets/
  2. APK: file:///android_asset/
    Now, what paths do we need to use? I actually did not understand much. So if anybody could help....
    I need to use those paths to show a HTML File that's already uploaded in the app inventor

Thanks

1 Like

I've added a full overview of the Android storage system - Scoped / Shared Storage (targetSdk=30, Aug 2021) - at the end of my guide.

5 Likes

I have added another detail to my overview (top right, see pink box) and thus completed the overview.
( I hope. :wink:)

15 Likes

#off topic
@Anke may I know how did you made this Flow chat , I mean which website are you using to make this flowchart

You can use diagrams.net

2 Likes

Thank you Anke.This chart and information are perfect and very useful...

1 Like

I made it (the adaptations) with → paint.net.

2 Likes

Really, you have perfectly depicted the storage components and their relationship, thanks @Anke

1 Like

Hi Anke, Mny thks to come back to his issue.
As i was able to save and not read, i suspected something like that. But your synoptic(overview) is crystal clear !
Have a nice WE
Loïc

1 Like

This post is very interresting and i learned a lot.
But I don't undertand all...so i used the app below to try understandind where are files for differents scope.

App
file is stored in /storage/emulated/0/Android/data/ `packageName/files/filename

Asset
I have an error when write file:
android_asset/filename could not be created !

Cache
File exists, i can read it, but with a file manager i don't succed to find it so i don't know where it is stored...

Legacy
same as Cache

Private
same as Cache

Shared
file is stored in /storage/emulated/0/filename
I can know it exists, i can delete it, but I can't read it ! app bugs and stop...

T2File1.aia (65,8 Ko)

Is someone could help me to understand ?

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.

did you read the first post in this thread? here it is

you will have to store it in a valid directory for shared storage, which is for example /Download, /Documents, /DCIM, /Music

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

That means it's impossible to show those files in a file manager !?

Ok, but it's strange we are able to write a file in a location we can't read from no ?

correct, see also the documentation Storage

which Android version are you using for your tests?
any screenshot of your relevant blocks?
how did you test? using the companion app? using the apk file? try again using the apk file...

Taifun

Yes, that would really be strange. But this is not the case, I'm sure.
Post your blocks and the aia (or a test aia). Also mention the Android version you're testing on and whether it's with Companion or the APK.

Sorry, i realise that the aia file i shared in my post had to many blocks to understant what happen.
so you will find here a very simplest one.
shared_File.aia (34,0 Ko)

fisrt button to save file in shared (directly in emulated/0)
second one to check file exist
and third one to read it.

when I test it, file is saved and i can check it, but when i try to read it app bugs ans stops.
same in companion or with apk

I can see and open it with my file manager:

Android version: 10 QKQ1.191014.001 on redmi 7A

There are some bugs with the File comp. Try with FileScope = Legacy instead of Shared.