Where does LocalFileSystem.PERSISTENT indicate?

In PhoneGap, I use

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail); 

to access the file system.
My ASUS tablet does not have an external sdcard (I do not insert any removable devices), so I think the root system of the file system points to internal sdcard . However, on my HTC Desire HD, the data was written to an external sdcard . (Since the data is just on a microSD card.)
So what's the truth? I don't see any hints in the W3C document, maybe I missed something ...

PS: Both versions of the android are ICS (Ice Cream Sandwich).

+7
source share
1 answer

PhoneGap FileAPI, while designed to mirror the HTML5 specification, is actually a custom implementation of the W3C document. Here you can find documents related to their API. Although they can basically be used the same way, there are some subtle differences between how things are implemented on the Internet and on the device. Storage is one of them.

To find out how PhoneGap handles persistent storage, I had to dig out the source code of Cordoba. This file contains the methods used by PhoneGap FileAPI. The corresponding code block starts at line 871. In principle, the API will call Environment.getExternalStorageState() . If this returns Environment.MEDIA_MOUNTED , which means there is a removable or non-removable SD card for storage, the FileSystem returned by the API is the root directory of the mounted storage using Environment.getExternalStorageDirectory() . This explains the difference in behavior that you observed between devices with internal and external SD cards, which were considered as built-in external storage by the system. If you encounter a device without external storage, that is !Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) , the root of the returned file system will be "data / data / packageName" in the internal storage , similarly calling Context.getFilesDir() , which usually returns something like "data / data / packageName / files".

+15
source

All Articles