I am developing an Android application using Cordova. I am already familiar with FileTransfer, and I already know how to upload a file. The problem is that when I download a large file (20 MB), this download takes some time without notifying the user that something is actually happening.
All I managed to do was upload the file to the SD card via:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
and then show the dialog to the user who downloaded the file, and where he can find it. But I want to inform the user about the progress. Or can you somehow handle this file transfer in the background so that the user can see the download icon in the top bar of Android in the same way as when downloading a file through the default browser?
Thanks so much for any help.
code:
document.addEventListener('deviceready', function() {
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, function(){
console.log("error getting LocalFileSystem");
});
}, false);
function gotFS(fileSystem) {
window.rootFS = fileSystem.root;
}
fileTransfer.download(
http:
window.rootFS,
function(entry) {
console.log("download complete: " + entry.fullPath);
},
function(error) {
console.log("download error source " + error.source);
},
);