PolCPP / nativescript-downloadmanager

A small library to download files with android DownloadManager from nativescript
9 stars 10 forks source link

Problem to download file! #4

Open nrbn opened 6 years ago

nrbn commented 6 years ago

My app is not on typescript, just plain javascript. Do I do it right? I can not download.

I try to download the url that is being sent to this function. But dm.downloadFile does not work. Console log "inside downfile" is not getting called.

var DownloadManager = require('nativescript-downloadmanager');
`
function DownloadFile(url) {
    let dm = new DownloadManager();

                                    dm.downloadFile(url, function(result,uri) {
                                        // result is a boolean, if the download was successful, it will return true
                                        console.log("********************************* inside downfile ****************");
                                        console.log(result);
                                        // Uri in file:// format of the downloaded file.
                                        console.log(uri);
                                        // unregisterBroadcast is used to unregister the broadcast (For example if you just want to 
                                        // download a single file).
                                        dm.unregisterBroadcast();
                                    })
}`
caiusCitiriga commented 5 years ago

For this kind of questions, please use stack overflow