Why createFile() method can not create file


My development platform is Android 5.0.2, and I followed API document of $cordovaFile carefully, the following is my code snippet:

$cordovaFile.createFile(cordova.file.dataDirectory, “test.txt”, true)
.then(function (success) {
}, function (error) {

In fact, I got ‘OK’, but I can’t find file test.txt in foler files. Can anybody help me? Thanks a lot in advance.


i got the same doubt, did you find the solution?


Are you looking at the right place? You can do console.log(cordova.file.dataDirectory) to see where was your file created


My console.log(cordova.file.dataDirectory) print : file:///data/data/com.ionicframework.myapp423380/files/ , but in the windows explorer ( Galax\Phone\Android\data\com.ionicframework.myapp423380\files ) not appears any file… thanks


what is console.log(success) show you?


02-16 09:55:39.922 8962-8962/com.ionicframework.myapp423380 I/chromium﹕ [INFO:CONSOLE(57)] “[object Object]”, source: file:///android_asset/www/js/controllers.js