This may well be something very simple but I can’t find it for the life of me. In my app I use ngcordova file and file transfer plugins. They are both present and working.
I have some code that when called will download a file to the local file system, this works fine and the file is downloaded without any issue and success called, or error called if I pull the network connection part way through.
The problem is I don’t receive any progress events at all and I can’t figure out why? I have followed the guide on the ngcordova example and various other examples but progress just never seems to get triggered at all.
A simple console.log in the progress block never even executes.
Here is a sample of my code where error and success work fine but progress is never entered:
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
.then(function(result){
//Success
//inject the file location into the song object
song.targetPath = targetPath;
//updated the cachedSongs list with the new object
o.updateCachedSongs(song);
console.log("successfully downloaded: " + song.title);
}, function(err){
//Error
console.log("download failed for " + song.title);
}, function(progress){
//Progress
console.log("test1");
$timeout(function () {
console.log("test2");
downloadProgress = (progress.loaded / progress.total) * 100;
})
});
})
Any pointer would be greatly appreciated as once the progress event is actually being called then I can add a progress indicator for downloads for the user.
I am working on ios 8.3, same behaviour on physical device or emulator.