PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → 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
Started by NernakinBandhoo, Nov., 28 2022 8:58 AM - 2 replies
Registered member
3 messages
Posted on November, 28 2022 - 8:58 AM
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 ?
Registered member
3 messages
Posted on December, 26 2022 - 12:42 PM
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.
Posted on March, 03 2023 - 1:25 PM
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