Listing and viewing files in cordova.file.dataDirectory / cordova.file.cacheDirectory

This is not an Ionic or ngCordova question per-se, but since I believe it is quite a common issue that other Android developers should have encountered before, I am testing my luck here.

I am playing with the Cordova File plugin using ngCordova. Like many developers, I need to inspect the files that are created, and written to in cordova.file.dataDirectory and cordova.file.cacheDirectory by the File plugin.

Since I am using an Android phone for testing, I realise by chance that there are third party Android apps like ES File Explorer that can browse and open up the cordova.file.externalDataDirectory and cordova.file.externalCacheDirectory if you know where to look. They are tucked away discreetly in /Android/data/<app-package-id>.

However, I have dug around the file system and I can’t find a way to locate and browse the directory cordova.file.dataDirectory or cordova.file.cacheDirectory. It seems to me that they are hidden and internal only to access by the app itself only. In other word, other third party file system explorer apps cannot see or find them. An exception situation when they may be accessible or visible to such apps might be only when the phone is rooted.

I have come across suggestion online that to access the directory and see the files, we can use adb shell run-as <app-package-id> kind of command to do so. I am wondering if there are other more user-friendly methods?

1 Like

Same problem here. I’m using Ionic Native File to check for a directory and if not to create one, code works well - new directory is created but I can’t find it anywhere, not even on my PC with Windows that can look for hidden files.