1

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 ?

coutier eric
  • 949
  • 5
  • 18

1 Answers1

3

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Comment like below: So, if I understand, on some phones/tablet, when you insert a SdCard, a question like "Do you want to set the sdcard the main storage device" is asked (if i remember). Does it mean that the "destination" of getExternalFilesDir can change if I answer yes ? – coutier eric Apr 04 '17 at 12:32
  • @coutiereric: Since I have never seen that particular prompt appear on any Android device, I cannot comment on what that prompt might mean, sorry. – CommonsWare Apr 04 '17 at 12:39
  • The message is on a Lenovo tablet : "Do you want to change the default writing disk ?". If I answer OK, Android show me a parameter where I can change the "Default writing disk". But, event if I change to SD Card, the getExternalFilesDir(null) return the same path and it point to the same physically folder. I verified that because before inserting the SD Card, I've manually copied a file that it always here. So it seems to me that folder getExternalFilesDir(null) is fixed by the manufacturer. If I want to access to other locations, I have to user getExternalFilesDirs[]. – coutier eric Apr 04 '17 at 20:19