Open lankesri opened 3 years ago
Please mention the exact error from ADB console.
this is what im getting in console "Uncaught TypeError: Cannot read property 'download' of undefined"
It seems your download method is accepting JSONArray args, CallbackContext callbackContext
then how can we call like this
cordova.plugins.DownloadManager.download(url, "pdf","Download Successful" ,success, fail);
Thank you
It comes to my attention that this plugin is not supported in Android 10 and 11. Try out in lower version and let me know how that goes.
actually me working on android 7 only
Try this plugin https://ionicframework.com/docs/native/downloader
will try and let you know. thank you
Hi Vasani-arpit, file is downloading but there is no progressbar in notification section Please find the code here
var request = {
//Location of the resource to download
uri: url,
//Title of this download, to be displayed in notifications
title: 'Downloading',
//Description of this download, to be displayed in notifications
description: 'pdf download',
//This will override the content type declared in the server's response.
mimeType: '',
//Set whether this download should be displayed in the system's Downloads UI. True by default
visibleInDownloadsUi: true,
//Control when a system notification is posted by the download manager.
notificationVisibility: 0,
// Set the local destination to a path within the application's external files directory
/*destinationInExternalFilesDir: {
dirType: 'Downloads',
subPath: '' //Path within the external directory, including the destination filename
},*/
//Set the local destination to a path within the application's public external storage directory
destinationInExternalPublicDir: {
dirType: 'Downloads',
subPath: '' //Path within the external directory, including the destination filename
},
//Set the local destination for the downloaded file.
//destinationUri: '',
//Additional HTTP headers to be included with the download request.
//headers: [{header: 'Authorization', value: 'Bearer iaksjfd89aklfdlkasdjf'}]
};
cordova.plugins.Downloader.download(request,
(location) => { alert('File is downloaded at' + location) },
(err) => { alert(err)})
any news to solve the problem?
Unfortunately no, Use this one if possible --> https://ionicframework.com/docs/native/downloader
show alert json error is an error while you used without option , i'm already used this plugin in my project and it work fine
downloaded the zip and the did Uncompress and added the plugin to current project as
cordova plugin add C:\Users\vijayavarma.l\Desktop\Temp\cordova-plugin-downloadmanager-master
And added the below code in download method
and finally getting below error
Getting JSON error while downloading the file from url
Please help me out. Thank you