Page 1 of 1

Android Download file

Posted: Fri Jun 12, 2015 9:46 am
by rblackmore245
I have been trying to download files in android, but have been unable to get any of the functions to work has anyone else managed to get LC to download a file to the local sdcard in android ?

if so how lol ?

Re: Android Download file

Posted: Fri Jun 12, 2015 11:40 am
by Klaus
Hi rblackmore245,

1. welcome to the forum! :D
2. What did you try so far?
Please post your script(s).
if so how lol ?
What is so funny? 8)



Re: Android Download file

Posted: Fri Jun 12, 2015 11:42 am
by rblackmore245
Hiya Thanks for your reply

I have managed to get it to work with the "load URL" function but seems to crash and close the app after about 10Meg are there file limits associated with this function, is there another method I can try that will be able to download file sizes of around 30Meg to the device ?

global tFileName
on mouseUp
put "about.flv" into tFileName
put "websitehost/" & tFileName into pUrl
-- start the download process, telling Rev to call the "downloadComplete" handler when finished
Load URL pUrl with message "urlProgress"
end mouseUp

on urlProgress pURL, pStatus, pBytesDone, pBytesTotal
switch item 1 of pStatus
case "loading"
put the round of (item 1 of pBytesDone / 1024)&& "KB Downloaded" into field "status"
case "cached"
-- work out a file name for saving this file to the desktop
set the itemDel to slash
put "binfile:" & "mnt/sdcard/test.flv" into myPath
put url pUrl into url myPath
answer "Download completed" with ok
-- to save memory, now unload the URL from memory
-- this also means that if you want to run the test again, it does not just use a cached version
unload pURL
case "error"
if pStatus = "error" or pStatus = "timeout" then
answer error "The file could not be downloaded." with "ok"
end if
end switch
end urlProgress

Re: Android Download file

Posted: Fri Jun 12, 2015 11:55 am
by Klaus
No idea if there are limit, but I don't think so.
But "load url..." will load the complete url into MEMORY!
Maybe that is the problem here? Try with "liburldownloadtofile..."

Re: Android Download file

Posted: Fri Jun 12, 2015 12:55 pm
by rblackmore245
Have tired libURLDownloadToFile but seems to always stop at 1.8mb and then crash is this a problem with my android device or a problem with libURLDownloadToFile ?

As have tired it on three different versions of android and three different devices. Im using livecode 7.1 could this be the issue ?

Updated----- Managed to fix the problems by using livecode 7.0.5