Question about Files, Scopes and Android Levels (US and EU)

Hi,
I use a Samsung J5, Android 9, Level 2.62, API29 and I have only tried Scopes in Companion (default Scope is set to 'APP').
Write/Read Files are changed (due to changes in Google) from 'NH187'.

Here is what I experience:

Question about FILES32.pdf (212.1 KB)

I am aware that some of the Scopes should/cannot be used for Write/Read File (such as eg. write this years data and read the data in the following year, so that the user can see both this year's data and last year's data), but I have set what really happens on my phone. When I write about how it is working in the US and EU, it is because the question mark in the scheme above (?) indicates, that I do not know (and there is nothing about it, in Your guide and because I think there might be a difference here), 'OK' indicates that it works and 'Fail' indicates that it does not work.

*When the Scope 'APP' is the default setting, I suppose everything should work both before and after Android 11 (which, as I write, does not work in Companion on my phone).

**When it comes to 'Legacy' (which works in Companion on my phone) there is nothing that indicate what Scope to use from Android 11 and forward, so I like to know what Scope it is then ?

Please let me know, because I am totally lost here ?

Per

where is that guide you are talking about? any link?

from your pdf
Unbenannt

generally: have you already seen the overview and read that thread?

the file scope is independent on US/EU and should work everywhere...

please provide a screenshot of your relevant blocks for each of your issues including the error message you are getting, so we can take a look together

you might want to explain the purpose of your app so we can recommend, which scope would be best for your needs... generally it is advisable to store your data in the ASD - application specific directory together with file scope APP

yes...
an example would help to find out, where you have issues...

Taifun

Answers to Taifun's Questions;

where is that guide you are talking about? any link?

The MIT App Inventor Library: Documentation & Support/Component Reference/Storage Component/File/ 'Scopes setup'

generally: have you already seen the overview and read that thread?

Yes, and I think it is good that there is a concept of what, how, when, etc. you can/should report in the community, although some things (you can't find anything in writing about) you have to put on the community, I think, to possibly get an answer (I've spent some time searching and reading through the community to find answers to my questions) and yes, I have also printed the 'graphic image' which after all gives a good visual picture of how Storage works (or should work) without finding directly answers to what I am looking for

the file scope is independent on US/EU and should work everywhere...

File scope might be correct, but I can give you one example of where there is a difference;

In US date is written; MMddyyyy (10/11/2022) and sometimes mmmddyyyy (okt/11/2022)
In EU date is written; ddMMyyyy (11/10/2022)

If you take a copy of something with date that is made in US and put it in your projekt, it directly gives an error in EU, if you don't change the date to your own format, immediately (so who knows where there is other differences)

the rest of the questions asked by Taifun;

Thank you very much Taifun for your remark at the end of your answer, which is 'yes...'

This indicates that the Scopes are default set to Android11. So in my case (I have Android9) my phone only write/read files with Scopes set as default to 'Legacy' (in Companion) and that is what I could'n find anything in writing about.

I have done it like this (because I don't know which Android system my users have on their phone);

[MIT App Inventor.pdf|attachment](upload://ze9rnl4aI5GW1yF2nkL14oDcCCZ.pdf) (181.9 KB)
[MIT App Inventor2.pdf|attachment](upload://rUJSpsKwJ5POiEM3yuLiNKCLc8C.pdf) (329.2 KB)
[MIT App Inventor3.pdf|attachment](upload://8if2H8HUGjezw6fJCP93Kmvq8Nf.pdf) (403.9 KB)

Finally, I store my files (external) in ASD this way: Festi/Festivitasyyyy.csv
and (internal): Festivitasyyyy.csv

Is this the correct way to do it ? (my next projekt is how to make a PDF file instead of an external file, I think).

Per

MIT App Inventor.pdf (181.9 KB)
MIT App Inventor2.pdf (329.2 KB)
MIT App Inventor3.pdf (403.9 KB)

Read this and try the aia provided in this post (and you will probably understand):

The ASD works without storage permission since API 19 (Android 4.4 / KitKat).

2 Likes

Thanks Anke,
I have read the tekst you recommended and seen the aia versions and I can understand there is some problems to solve.
The problem I had was that there were nothing that gave me an answer on what scope (it could not be Legasy) to use from Android11 and 11+ (other than default, who was set to APP, and was confirmed by Taifun), because I have Android9 which I have set to Legacy.
But I should only write/read files with the scope Legacy, which was the easy part of the discussion and not the other things which apparently is much more complicated.

The dato I mentioned was just an example of a difference between US and EU, and was not intended as a question (I use the dato overall in my system under different pattern).

Per

So where exactly is the problem, if it still exists?

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 rather than posting pdf files post a screenshot of your relevant blocks...
Thank you.

Taifun


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

2 Likes

Hi,
Yes, I got it and I am sorry to make that trouble with PDF files.
Next time I will send you a screenshot, with the relevant question.
If the,
Scope=APP works with Android11 and 11+
and
Scope=Legacy works with Android10 or below (which Taifun have agreed with), my problem are solved for now. :slightly_smiling_face:
(Only, with the scope APP my phone still does not Write/Read Files to/from the storage, as I think it's suppose to do?)
Per

It works on all Android version.

It works on all Android version.

Of course, it should work on all Android versions. Show your blocks.

Is this so (is "Legacy" different in App Inventor) ? According to the documentation, Legacy gets ignored when targeting Android 11+

I'm talking (and I think the OP as well) about the FileScope.

This has nothing to do with "requestLegacyExternalStorage". You have no influence on this within the app anyway.

So as I said, FileScope = Legacy works on all Android versions.

OK, two different things then :slight_smile:

Hi,
Here is some of the blocks you demand, Anke
Building the system (write a file to Testsystem)





Read the file into the system subsequently






I don't know of these 'printscreen' pictures gives anything, but you say, that scope 'Legacy' (and scope *APP') works on all phones (only on my phone the scopes works as I describes, apparently)

So post a simple test aia (as small as possible!) and the relevant blocks.

grafik

You try to read from the Private directory (internal storage) since you set FileScope = Legacy.

grafik

You should learn some basics first, see e.g. here:

1 Like

By the way, this part is no longer up to date:

grafik

I will make a simple aia file and when it's ready, I will let you know
Per

still confused, the AI2 documentation says this:

  • 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.

Of course, you cannot write / read to / from

  • the root directory or
  • an arbitrary (sub)folder

of the external storage on Android 11+. But you can write / read to / from one of the Shared folders using FileScope = Legacy (also on Android 11+).

These Shared folders (for non-media files) are:

  • /Documents
  • /Download