PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Is it guaranteed that getExternalFilesDir() and getFilesDir() are on the same storage device
Is it guaranteed that getExternalFilesDir() and getFilesDir() are on the same storage device
Débuté par NernakinBandhoo, 28 nov. 2022 08:58 - 2 réponses
Membre enregistré
3 messages
Posté le 28 novembre 2022 - 08:58
I develop an app with PCSOFT Windev CASE. There's an instruction "fRepExe" that is equivalent to getFilesDir.

Instead of that, I have replaced it by a call to java instruction getExternalFilesDir, that permit to see the files from a file manager, for an example or via USB cable on the PC.

My question is : is it sure that getFilesDir reside on the same storage device than getExternalFilesDir ?

For an example, if getFilesDir is on the internal storage, is it sure that getExternalFilesDir is on internal too. If getFilesDir is on the external sdcard, is it sure that getExternalFilesDir too ?
Membre enregistré
3 messages
Posté le 26 décembre 2022 - 12:42
There are no guarantees regarding the partitions used for getFilesDir() and getExternalFilesDir(). In fact, on Android 1.x/2.x, it was very likely that they would be on different partitions of different media.

Nowadays, it is likely that getFilesDir() and getExternalFilesDir() are on the same partition of the same media, but you should not assume that.
Posté le 03 mars 2023 - 13:25
Hello
According to the official Android documentation, getExternalFilesDir() and getFilesDir() may or may not be on the same storage device, depending on the device's implementation and the user's configuration.

getExternalFilesDir() returns the path to the directory on the primary external storage device where the application can place files that are persistent across reinstalls of the application. This storage may be a removable storage media (such as an SD card) or an internal (non-removable) storage.

getFilesDir() returns the path to the directory on the device's internal storage where the application can place files that are persistent across reinstalls of the application.

So while it is possible for the two directories to be on the same storage device, it is not guaranteed. The actual location of the directories will depend on the specific device and the way the user has configured their storage options.

I hope this will help you.

RPA Developer Certification