Page 1 of 1
Android Upload / Download zip files issues
Posted: Thu Mar 06, 2014 3:10 pm
by istech
I have been using a script by "jmburnod" "
http://forums.runrev.com/phpBB2/viewtop ... =8&t=13466" to test out downloading and extracting zip files.
However I have only been able to get it working on desktop not Android.
However checking the code I do not see why it does not work on Android as all the code (as far as I can see) is compatible. So as I searched and came up with this post by "kray"
http://livecodejournal.com/forum/viewto ... ?f=24&t=92
Is this still the case with the latest build of LC with Android Apps? This libURLDownloadToFile is unreliable?
Just to add, I am using the latest build of LC, Have added internet, revZip, and write to external storage to the standalone and use Android 4.3 on the Android Emulator.
I have tried small files and large files the download function just does not activate.
Thanks in advanced guys
Re: Android Upload / Download zip files issues
Posted: Thu Mar 06, 2014 10:44 pm
by Simon
Hi istech,
I don't know why that libURLDownloadToFile entry still says it's good for mobile. I don't think it ever worked on mobile?
Go with Ken Ray's "load" or use "put url".
Nice that load has that pData, makes it easy.
Simon
Re: Android Upload / Download zip files issues
Posted: Fri Mar 07, 2014 1:26 pm
by jmburnod
Hi Simon
LibUrldownloadToFile works on mobile. I tested it on IOS without mistake.
Re: Android Upload / Download zip files issues
Posted: Fri Mar 07, 2014 3:32 pm
by istech
Thanks for the reply
This issue apparently only happens on Android devices. If you have one give it a try and let us know.
Presently I am trying to get a working script with load url. Any pointers would be great in any case.
Code: Select all
on mouseUp
load url "http://www.alternatic.ch/jmb/devrev/images50.zip"
hide scrollbar "ProgressBar"
end mouseUp
on urlProgress pUrl, pStatus,pData
if the number of items in pStatus = 3 then ##will not work unless web server sends total
if the visible of scrollbar "ProgressBar" = false then
put the last item of pStatus into tTotalBytes
set the startValue of scrollbar "ProgressBar" to 0
set the endValue of scrollbar "ProgressBar" to tTotalBytes
show scrollbar "ProgressBar"
end if
set the thumbPosition of scrollbar "ProgressBar" to item 2 of pStatus
end if
if pStatus is "downloaded" then
answer "Finished downloading" with "Okay"
put pData into URL ("binfile:" & specialfolderpath("engine") & "/images50.zip")
hide scrollbar "ProgressBar"
unload url "http://www.alternatic.ch/jmb/devrev/images50.zip"
send "unZip" to me in 2 seconds
end if
end urlProgress
command unZip
put specialFolderPath("engine") & "/images50.zip" into TempFile
put specialFolderPath("engine") & "/" into TargetFile -- Problem part, previous one was linked to a map in a map, because the zip is a map.
revZipOpenArchive TempFile, "read"
put RevZipEnumerateItems(TempFile) into tList
repeat for each line i in tList
if i = empty then
next repeat
end if
revZipExtractItemToFile TempFile, i, (TargetFile & i)
end repeat
revZipCloseArchive TempFile
delete file TempFile
send "fileCheck" to me in 1 second
end unZip
command fileCheck
if there is a file (specialfolderpath("engine") & "/pres.png") then
answer "it works!! Great!"
else
answer "needs more work"
end if
end fileCheck
At the moment it is in "needs more work"

Re: Android Upload / Download zip files issues
Posted: Fri Mar 07, 2014 6:43 pm
by jmburnod
Hi,
Are you sure we can download a file to the engine folder ?
I never did it
Re: Android Upload / Download zip files issues
Posted: Fri Mar 07, 2014 6:52 pm
by Klaus
No, we CAN'T!
@istech:
specialfolderpath("engine") is TABOO for writing!
Use specialfolderpath("cache") or specialfolderpath("documents") to store the loaded zip file!
Re: Android Upload / Download zip files issues
Posted: Fri Mar 07, 2014 9:03 pm
by Simon
Hi,
put pData into URL ("binfile:" & specialfolderpath("engine") & "/images50.zip")
That's not good, you can't write to the engine folder.
put pData into URL ("binfile:" & specialfolderpath("documents") & "/images50.zip")
is where you want to put the file.
Simon
Re: Android Upload / Download zip files issues
Posted: Fri Mar 07, 2014 9:44 pm
by istech
Ah thanks I will give it a shot.
Klaus you know I like doing things with the specialfolderpath you shouldn't or can't
Can we copy to the engine location after we download? Or is it strictly no go. (gone to have a look at the docs again)
Re: Android Upload / Download zip files issues
Posted: Fri Mar 07, 2014 10:24 pm
by jmburnod
Hi istech,
Can we copy to the engine location after we download?
No.
As Klaus said
specialfolderpath("engine") is TABOO for writing!
Re: Android Upload / Download zip files issues
Posted: Fri Mar 07, 2014 11:16 pm
by Klaus
istech wrote:Klaus you know I like doing things with the specialfolderpath you shouldn't or can't

No, I don't know, but it is up to you to let your device EXPLODE!
