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