See here:
So, if I understood correctly, this folder:
/storage/emulated/0/Android/data/packageName/files/
is the one that is shown when I connect my Phone to my PC via USB as:
/Android/data/packageName/files
?
Both paths are identical...
The first is a full path, the second a relative path on the internal (emulated) sdcard...
You might want to elaborate, what exactly you are trying to do...
Taifun
1. This path is an → absolute path:
/storage/emulated/0/Android/data/packageName/files/
2. and this path is a → relative path:
/Android/data/packageName/files
Some components need a relative and others an absolute path.
3. And on top of that, some components or Android versions require a → full path:
file:///storage/emulated/0/Android/data/packageName/files/
I would recommend these 3 terms to distinguish the paths:
- relative path (e.g.):
/Download
- absolute path:
/storage/emulated/0/Download
- full path:
file:///storage/emulated/0/Download
Hi, I'm developing a Contacts App, that reads the contacts from a CSV file.
But I don't want to redistribute the App every time a new contact is added to the list, so the contacts file must be a in a place that's accessible both by the App and by a PC with a USB connection to the phone.
That being said, what do I need to enter on the file name in order to read if from /storage/emulated/0/Android/data/packageName/files/
?
Best Regards,
Rui
Yes, I did.
From what I understood,the filename must be "/Android/data/packageName/files/filename.extension"
Is this correct?
Best Regards,
Rui
On Android 10+ (to save / read a text file with the File
component) the path is:
/fileName.txt
This path is redirected to the ASD for devices with Android 10+.
and on Android < 10 the path to the ASD (for the File
component) is a relative path:
/Android/data/packageName/files/fileName.txt
Why don't you store the file in a shared directory?
/Downloads
or /Documents
would be the correct place..
Taifun
And how would I reference a shared directory such as /Downloads or /Documents?
As already said
Taifun
So they are interchangeable? I can use any of the 3 formats?
These questions might seem silly to you but I'm only using MIT App Inventor for a week
as @Anke already tried to explain, generally they are the same, however some components require a specific format
please check the documentation for which type of path to use... for the file component just use the relative path
Taifun
Hi, good afternoon.
I've been trying to save the file on /Downloads, but without success.
I've tried:
/Download/test.txt
/storage/emulated/0/Download/testt.txt
file:///storage/emulated/0/Download/text.text
But nothing worked....the file names are always appended to the ASD. For instance, if the file name is
/storage/emulated/0/Download/test.txt
it will try to save on
/storage/emulated/0/Android/data/appname//storage/emulated/0/Download/test.txt
Am I doing something wrong?
Best regards,
Rui
Maybe. If you expose your blocks or post an aia example of your Project, someone can evaluate what you are doing. This discussion appears to be going in circles. Post #13 indicates this issue is solved. That isn't corrrect?
It's as simple as this:
This is correct to save a text file with Android > 9 in the subfolder /Download
of the ASD
.
But this subfolder (/Download
) does not exist (in the ASD
). So you must create it beforehand using e.g. the TaifunFile
or FileTools
extension.
Hi Anke,
yes, but my goal was to save it on /storage/emulated/0/Download/
Rui
This will no longer work with the coming update (targetSdkVersion = 30
)
(which should actually already be available from Aug).