An Android Cordova plugin that allows you to download files using download manager. You can start more than one download and each of them will be presented on the notification bar. You can handle the progress and cancel each download. This plugis handles also download cancellation taken on the notification bar. If you work with ZIP
archive you can extract it with this plugin also.
cordova plugin add cordova-plugin-files-downloader
- Android
FilesDownloader.download('https://cordova.apache.org/static/img/cordova_256.png', file, {
title: 'Downloading...',
extract: false
}, (result) => {
// progress
}, (err) => {
// err
alert(JSON.stringify(err));
});
Parameters:
-
remoteUrl: URL of the file to download
-
destinationFile:
FileEntry
object -
options: Optional parameters (Object). Valid keys:
- title: The download title in the notification bar
-
extract: If true, downloaded
ZIP
archive will be extracted when completed. You receivefinished
status when extraction will be finished.
-
successCallback: A callback with download status and progress. (Function)
-
errorCallback: A callback that executes if an error occurs. (Function)
FilesDownloader.cancel('https://cordova.apache.org/static/img/cordova_256.png', (result) => {
// ok
}, (err) => {
// err
alert(JSON.stringify(err));
});
Parameters:
-
remoteUrl: URL of the file to cancel active downalod
-
successCallback: A callback with cancellation status. (Function)
-
errorCallback: A callback that executes if an error occurs. (Function)