I am trying to save a generated html file in my ionic app to my android device. I am using $cordovaFile to try and write the file using the following code:
I tried looking at the device using windows file explorer and I can’t find it in the device (I used the seach function to look for Order26.txt). I also looked at My Files in the device but there is no file in the Device storage/Android/data/com.tamangsistema.taraletsbackoffice/files directory. By the way, I tried this with 2 devices (Samsung S4 and Samsung Tablet 3V) with the same result. I was expecting that the file will be saved somewhere within the device.
The file was written correctly and read it without errors, but you can not see in your device with a file explorer because you wrote the file in a private location, this means that only your application can access to it. This is useful for files that you want access but not your users.
take a look to the ngCordova documentation, more especifically to the Android File System Layout section. Here you can see where in the app is the file storage, if it is public or not, if it is persistent, etc…
If you want to see the file, and let your uses to see it too… you can use cordova.file.externalDataDirectory instead