B
B
Bogdan Pirozhok2017-10-23 20:14:36
Android
Bogdan Pirozhok, 2017-10-23 20:14:36

Error loading shaft from android app?

Good evening. There was a problem while developing a mobile app using Apache Cordova tools.
I need to implement the download of files (mostly pdf) that come in the server's response.
Apache Cordova has a plugin for this . I install it and use the script that the developers give in the example, it turns out like this:

$(document).on('click', 'a[download]', function (e) {
            e.preventDefault();
            uri = $(this).attr('href');

            downloadFile(uri);
        })

        function downloadFile(uri) {
           var fileTransfer = new FileTransfer();
           var uri = encodeURI(''+uri+'');
           var fileURL =  "/Download";

           fileTransfer.download(
              uri, fileURL, function(entry) {
                 alert("download complete: " + entry.toURL());
              },
                
              function(error) {
                 alert("download error source " + error.source);
                 alert("download error target " + error.target);
                 alert("download error code" + error.code);
              },
                
              false, {
                 headers: {
                    "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
                 }
              }
           );
        }

As a result, I get a number of errors as an alert:
1) download error source http//.... (file download error);
2) download error target /Download (error in the path to the download folder);
3) download error code 1 (I don't know what this error means);
Yes, to make sure that the first error is not related to the link to the file that I'm trying to download, I substituted different links, the result is always the same.
As for the second error, it’s more or less clear here, I’m not specifying the correct path to the download folder, but this is the case, I don’t know how the correct path should look like, please clarify this point
I would be glad for any help, because I myself am already off my feet lost, 3 days I struggle with this problem

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question