Closed enricodeleo closed 6 years ago
Hello, I'm sure you can use local push notification plugin to update user within onSuccess function.
Hi @enricodeleo! we've recently added possibility to run concurrent downloads for iOS. Please try it! I'll close this issue but feel free to reopen it or report a new issue if you have any questions.
Hello! I'm trying to download concurrent zipped files in IOS but doesn't works, in Android works well.
For example: At the first time, I'm lunching the download A, when this download haves 10% completed, lunch the second download B. This download B is starting directly at 10% and the download B is stopped, both downloads become a corrupted.
Seems like the promises combined in only one.
my code is very simple, i use VUE to manage the promises and stop the downloads when user wants:
`
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) { fileSystem.root.getFile(fileName, { create: true }, function (targetFile) {
(async () => {
var uriMatcher = "^" + fileName.replace(".", "\\.") + "$";
const downloader = new BackgroundTransfer.BackgroundDownloader(uriMatcher);
const download = downloader.createDownload(uriString, targetFile,chapter.title);
const onSuccess = function () {
const fileSaved ={
dirPath:targetFile.nativeURL,
fileName:fileName,
}
delete self.descargasActivas[chapter.id];
resolve(fileSaved);
}
const onError = function (error) {
console.log('Download startAsync Error: ', error);
delete self.descargasActivas[chapter.id];
reject(error);
}
const onProgress = function (progressEvent) { // progress callback
const progress = Math.round(progressEvent.bytesReceived / progressEvent.totalBytesToReceive * 100);
// console.log(progress,'%' ,chapter.id );
chapter.downloadProgress = progress;
}
// Start the download and persist the promise to be able to cancel the download.
const downloadPromise = download.startAsync().then(onSuccess, onError, onProgress);
await f7.store.dispatch('addDownloadPromise',{id:chapter.id, promise: downloadPromise});
})();
},(error) => {
console.error('Error al obtener el archivo:', error);
reject(error);
});
`
Any solution? I'm trying to pass a uriMatcher in BackgroundDownloader but doesn't works.
Hi!
I'm trying to get multiple files in iOS, I have something like this:
Checking the downloaded files it seems that only the last file is been written and the others are 0 bytes. I tried to live check the directory and I noticed that the last file changes size up and down during download, so I'm pretty sure that the download of all the files works but they are written sequentially on the same file (the last one).
Any hint? Thank you in advance! :)
ps what about porting https://github.com/thibaultCha/TCBlobDownload ?
--- UPDATE --- I solved for now by downloading a zip and unzipping onSuccess. I was wondering if I can notify the user somehow when the download ends and the app is in background mode. Ideas?