Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › download files to android

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23530

    jrrobles79

    Do I have to do something special to download files on Android?  I have already added the permissions to write on the device, and added almost the same code that the example on https://felgo.com/doc/felgo-downloadableresource/#open-downloaded-files

     

    I have the same code as the example just added some console.log:

    DownloadableResource {
               id: downloadableResource
               source: "https://www.dropbox.com/s/6radnxx1myevrpn/some_file.pdf"
               storageLocation: FileUtils.DownloadLocation
               storageName: "somefile_3.pdf"
               extractAsPackage: info.info_content.endsWith(".zip")
               onDownloadFinished: {
    
                   switch(error){
    
                    case  DownloadableResource.NetworkError:
                         console.debug("DownloadableResource: Network error");
                        break;
    
                    case  DownloadableResource.UnauthorizedError:
                        console.debug("DownloadableResource: Unauthorized Error");
                        break;
                    case  DownloadableResource.FilePathError:
                        console.debug("DownloadableResource: file path Error");
                        break;
                    case  DownloadableResource.FileExtractionError:
                        console.debug("DownloadableResource: File Extraction Error");
                        break;
                     case  DownloadableResource.DownloadCancelledError:
                         console.debug("DownloadableResource: Downloa dCancelled Error");
                         break;
                     case DownloadableResource.UnknownError :
                         console.debug("DownloadableResource: UnknownError");
                         break;
    
                     case DownloadableResource.NoError:
                     default:
                         console.debug("DownloadableResource: No error")
                         break;
                   }
    
               }
    
               Component.onCompleted: {
                   console.debug( "getting file:" + info.url )
    
                if(downloadableResource.status === DownloadableResource.UnAvailable) {
                     console.debug("resurce unavailable, download...")
                   downloadableResource.download()
                 } else {
                     console.debug("resurce available...")
                   openDownloadedFile()
                 }
               }
    
               onStatusChanged: {
    
                   switch(status){
                    case  DownloadableResource.UnAvailable:
                         console.debug( "Resource: UnAvailable");
                        break;
                    case  DownloadableResource.Available:
                        console.debug("Resource:  Available");
                        openDownloadedFile()
                        break;
                    case  DownloadableResource.Downloading:
                        console.debug("Resource:  Downloading");
                        break;
                     case  DownloadableResource.Extracting:
                         console.debug("Resource:  Extracting");
                         break;
                     default:
                         console.debug("No error")
                         break;
                   }
    
               }
    
               function openDownloadedFile() {
                   console.debug("opening file:" + downloadableResource.storagePath)
                 if(downloadableResource.status === DownloadableResource.Available) {
                   fileUtils.openFile(downloadableResource.storagePath )
                 }
               }
             }

     

    but when fileUtils,openFile is trigger it hust fkash the pdf reader and hides immediate, also I go to the device and search for the file and can’t find it on my downloads folder, or other folder, is like it didn’t downloaded but the DownloadResource.status said the file is available, what Im missing?      

     

    PD: I modified the pdf path since I was using a manual for an old client, and can’t publish that here

    #23532

    jrrobles79

    ===SOLVED (in part)===

    I found where the files are being stored, but I still have some issues, so  I will open a new Thread.

     

     

    #24562

    Julio Cesar Hoyos Vise

    Hello, where was this files stored ? cause my application is not even downloading .

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded