简体   繁体   中英

Cordova - How to access Device Storage?

I am developping an cordova application that contain a MP3 Player, for that, I have to get all MP3 files in the device, I know how to search in the SDCard (with cordova.file.externalRootDirectory) but, how to access to the classic Device Storage? (Where there is "Android", "DCIM", "Download"... folders)

Thanks in advance.

EDIT: The cordova.file.dataDirectory doesn't works

I'm using plugin cordova-plugin-file and it works for me to access to internal file storage

var folderpath = cordova.file.dataDirectory + "Download/";

Android directory structure

  • files: The application's internal file storage directory
  • files-external: The application's external file storage directory
  • sdcard: The global external file storage directory (this is the root of the SD card, if one is installed). You must have the android.permission.WRITE_EXTERNAL_STORAGE permission to use this.
  • cache: The application's internal cache directory
  • cache-external: The application's external cache directory
  • assets: The application's bundle (read-only)
  • root: The entire device filesystem
  • applicationDirectory: ReadOnly with restricted access. Copying files in this directory is possible, but reading it directly results in 'file not found'. Android also supports a special filesystem named "documents", which represents a "/Documents/" subdirectory within the "files" filesystem.

More information in Apache doc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM