Android Download file

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Android Download file

Post by rblackmore245 » Fri Jun 12, 2015 9:46 am

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 ?

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Android Download file

Post by Klaus » Fri Jun 12, 2015 11:40 am

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)


Best

Klaus

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Android Download file

Post by rblackmore245 » Fri Jun 12, 2015 11:42 am

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

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Android Download file

Post by Klaus » Fri Jun 12, 2015 11:55 am

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..."

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Android Download file

Post by rblackmore245 » Fri Jun 12, 2015 12:55 pm

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

Post Reply

Return to “Android Deployment”