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 ?
Android Download file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Android Download file
Hi rblackmore245,
1. welcome to the forum!
2. What did you try so far?
Please post your script(s).
Best
Klaus
1. welcome to the forum!
2. What did you try so far?
Please post your script(s).
What is so funny?if so how lol ?
Best
Klaus
-
- Posts: 67
- Joined: Fri Jun 12, 2015 9:42 am
Re: Android Download file
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"
break
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
break
case "error"
if pStatus = "error" or pStatus = "timeout" then
answer error "The file could not be downloaded." with "ok"
end if
break
end switch
end urlProgress
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"
break
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
break
case "error"
if pStatus = "error" or pStatus = "timeout" then
answer error "The file could not be downloaded." with "ok"
end if
break
end switch
end urlProgress
Re: Android Download file
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..."
But "load url..." will load the complete url into MEMORY!
Maybe that is the problem here? Try with "liburldownloadtofile..."
-
- Posts: 67
- Joined: Fri Jun 12, 2015 9:42 am
Re: Android Download file
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
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