Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
None
-
None
-
Visual studio 2015 with cordova, Android 4.4.2
-
Important
Description
I'm trying to create and write to a file in cordova.file.dataDirectory
(file:///data/data/<package name>/files/) or cordova.file.cacheDirectory.
But without success on android 4.4.2 .
The code fails on :
or using :
fs.root.getFile("myfile.txt",
, function () {}, function () {});
Example of code :
window.resolveLocalFileSystemURL(cordova.file.dataDirectory,
function (directoryEntry) { // success
directoryEntry.getFile('myfile.txt',
,
function (fileEntry) { //success
fileEntry.createWriter(
function (fileWriter) { // success
fileWriter.onwriteend = function ()
{ console.log("OK"); };
fileWriter.onerror = function (e)
{ console.log("Not OK"); };
// If data object is not passed in,
// create a new Blob instead.
if (!data) {
data = new Blob([' '],
);
}
data = JSON.stringify(data);
var blob = new Blob([data],
);
fileWriter.write(blob);
},
function (e)
);
},
function (e)
);
},
function (e)
);
directoryEntry.getFile doesn't work.
However, it works on Android 6