I am downloading the entire app with cordova filetransfer localy on the device and then redirect the index to the downloaded location.
But my issue is that i can't seem to find any solution for waiting for the filetransfer to be done before redirecting.
Her is my code for downloading:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
var fileTransfer = new FileTransfer();
var downloadUrl = "http://example.com/index.html";
var relativeFilePath = "example/index.html";
fileTransfer.download(downloadUrl, localpath = fileSystem.root.toURL() + '/' + relativeFilePath, function(entry) {
console.log("Success");
},
function(error) {
console.log("Error during download. Code = " + error.code);
});
I am doing so for each file. (approx. 200 files). Maybe there is a better way of doing it, but this works.
I have tried document.ready, $.when().done() but no luck. Any advice would be appreciated.
0 comments:
Post a Comment