Unable to access the files in the device memory

Hello everyone,
I can no longer access the files on my device (Android 10)
Post a simple app that shows the problem
In the internal memory of my device I have a directory called “atest”, inside there is a simple text file.
When I try to read that file I get a “file not found” error
I have all read / write permissions for the app and the file exists.
Until the version prior to 1.5.0 I have never had problems accessing the files.
What am I doing wrong?
Thank you all for your attention, I am available for clarification
Snap1

try using complete file path, something like:
file:///storage/emulated/0/atest/file.txt

Thanks Deepanshu_Arya
I tried two ways …
It always gives me the same “file not found” error …
Snap2

1 Like

The File component needs / uses a relative path.

For devices with Android > 9 this path
/atest/file.txt is redirected to the ASD:
/storage/emulated/0/Android/data/io.makeroid.companion/files/atest/file.txt

Where does the file file.txt come from (how did you save it)?

See also here (and best read the entire thread):

1 Like

Hi Anke,
The text file was copied from a pc to the phone

Then copy it to this dir (create the folder /atest in the ASD):
/storage/emulated/0/Android/data/io.makeroid.companion/files/atest/

So if this path exists on your device you will be able to read it:
/storage/emulated/0/Android/data/io.makeroid.companion/files/atest/file.txt

grafik

with Companion. With the APK this path should be:
/storage/emulated/0/Android/data/<packageName>/files/atest/file.txt

Try these blocks and check if the file.txt exists in the subfolder (/atest) of the ASD:
/storage/emulated/0/Android/data/<packageName>/files/atest/file.txt

I tried to do as you told me (I attach image of the blocks) …
But it still tells me “file not found”
I checked, the “atest” folder is located in “/ Android / data / /files/atest/file.txt”
… I don’t understand, I’m confused, I’m sure that until 2 months ago this simple way of creating folders, files and accessing them worked …
(I have not changed device or operating system and have not made updates)
Snap1

This should work. Post the aia.

Hello everybody,
I did the test described above again,
the folder and file is created in this path: “/ Android / data / / files / atest / file.txt” and not where I expect: my device / atest / file.txt
I have many other projects done with Kodular (up to 2 months ago) that worked great and created and read the files exactly in the folder I specified and not in the folder “/ Android / data / / files …”
What has changed? Am I doing some procedure wrong?

Thank you

The most important thing is how can I read and write in the paths I have used until recently, for example: “internal memory / atest / file.txt”
I have many projects that use this type of path … will I no longer be able to use them?
I am very worried …

The File component incorrectly asks for READ / WRITE permissions also for the ASD.
I have pointed this out often enough.

So you still need to ask for WRITE permission. This ia a bug.
@pavi2410

Try this:

Note: If the update for targetSdkVersion = 30 (Android 11) is available (which actually should already be the case), it is no longer possible to ask for WRITE permissions.

Thanks Anke,
now I'm in trouble ...
I have many apps (some on the PlayStore) that use absolute "decommissioned" paths (for example / atest / file.txt)
How do I migrate to the new paths (for example
/storage/emulated/0/Android/data/io.makeroid.companion/files/atest/file.txt) if I can't read the old paths anymore?

As almost all developers … :wink:

If you want to / have to update apps (in the Play Store), you have until the end of Oct 2021 to adjust this.

For a deeper insight, see here:

see also Evan’s blog, which talked about it already 1 year ago…
https://appinventor.mit.edu/blogs/evan/2020/08/08/file-path-updates-android-10

Taifun

Thank you all,
I did some testing by applying your suggestions
I would like to update my apps to the new path (ASD) but …
I can no longer copy files in folders inside the device to the new path in ASD
The sharing function does not help me to make this transfer …

Ciao Paolo mi trovo nella tua stessa situazione. Con la versione 11 di Android non posso più leggere un file salvato nella memoria interna del mio cellulare.
Posso sapere si hai risolto e come?
Grazie

Adolfo

Translation added by Mod

Hi Paolo, I am in the same situation as you. With version 11 of Android I can no longer read a file saved in the internal memory of my mobile.
May I know if you have solved it and how?
Thank you

Adolfo

Community’s official language is English. Please next time follow community’s rules

I’m sorry.

1 Like

see here

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun