Ionic 2 - Accessing Device Storage using Cordova Plugin


#1

I am trying to access the files and folders in Android and I could only access the application storage using corodva.file.dataDirectory but no the other file locations.

Can you please help me on this.
And it would be great if Ionic 2 team provides us a good doco on how to use these commonly used plugins.


#2

What other location are you trying to access, and what happens exactly when it doesn’t work? People need some more details to be able to help you.

The Cordova File plugin has its own documentation.


#3

Thanks for the reply.

when DataDirectory is used the location of the file it points in under DeviceStorage/Android/Data/com.ionicframework.appXXXXXX and when File.listDir is used it says that there are 3 document entries one called files another called cache and the last as documents which I couldnt even view when browsed in the mobile. Ands also I tried creating a directory using File plugin and it say it have created the directory but i couldnt see that file either.


#4

The dataDirectory is private to the app, that’s why you as a user cannot see it when browsing with a file manager. (Unless you have a rooted device.) Sounds like everything is working as designed.


#5

Thanks. Can you please point me which to use in order to access normal existing files more of like a file browser.
Because Cordova has for externalStorage( cordova.file.externalRootDirectory ) but may I am turning blind but I couldnot see anything promising for me to access the device storage.