android - Cordova app doesn't see file changes until it is restarted, but other programs see them -
i'm modifying image in cordova app file plugin, testing on android 5.0.2. write image file location, read back. changes not visible in image! in es file explorer, can see changed image. , if kill cordova app or re-download it, changes visible.
i'm thinking there caching going on, don't know how flush , proceed... or maybe there else going on?
here code using write image:
function writecurrentfile (thecanvas) { g_currententries[g_entrynum].createwriter ( function createwriterok (filewriter) { // createwriter() success filewriter.onwriteend = function (e) { writelog ("wrote file w/ note: " + g_currententries[g_entrynum].name); }; filewriter.onerror = function (e) { writelog ("error writing file w/ note: " + g_currententries[g_entrynum].name + ": " + e); }; thecanvas.toblob (function (blob) { filewriter.write (blob); }, "image/jpeg", 0.95); }, function createwriterfail (error) { // createwriter() error console.log ("error creating file writer: " + error); alert ("error creating file writer: " + error); }); }
and here code reads back:
function readback () { var tempimg = new image(); var pic = cordova.file.externalrootdirectory + g_currententries[g_entrynum].fullpath; var pichtml; var source = g_currententries[g_entrynum].fullpath; tempimg.onload = gotimg; // sets callback function tempimg.onerror = imageerror; tempimg.src=pic; function gotimg () { document.body.appendchild (tempimg); } function imageerror (){alert ("image error"); } }
Comments
Post a Comment