libUrlDownloadToFile callback message not working in android

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
domp
Posts: 3
Joined: Fri Sep 27, 2013 4:09 am

libUrlDownloadToFile callback message not working in android

Post by domp » Fri Sep 27, 2013 4:33 am

Hi all

I am using the example of libUrlDownloadToFile from
http://forums.runrev.com/viewtopic.php? ... ile#p70253

it works fine when I run the scripts in the IDE but if I send it to the emulator (android 2.2) the file downloads correctly but there is no callback messaging. I have also added a libURLSetStatusCallback callback, and once again, that works in the IDE but not in the emulator. Is this a known issue in Android?


cheers

Dom

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: libUrlDownloadToFile callback message not working in and

Post by Simon » Fri Sep 27, 2013 5:34 am

Hi Dom,
Welcome to the forums :)

I'm sorry but libURLSetStatusCallback doesn't work in mobile.
It's shown in The Supported Operating Systems in the dictionary.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

domp
Posts: 3
Joined: Fri Sep 27, 2013 4:09 am

Re: libUrlDownloadToFile callback message not working in and

Post by domp » Mon Sep 30, 2013 4:27 am

Hi Simon

thanks for pointing that out. I still have the issue of the callback message in libUrlDownloadToFile not being called. I thought that maybe Android 2.2 was too old so created an emulator using Android 4.3, but still have the same problem.

Using the example code below, which is all contained within a button -

In the IDE, the timer message directly below libUrlDownloadToFile is called instantly (showing 0) and then the downComplete function is called when the download is completed, as expected. However, in the Android emulator, the timer message is only shown once the download has completed and the downComplete function is never called.

It seems as if Android is not downloading the file asynchronously? Is there some other setting I have to change to allow asynchronous downloads?

cheers

Dom

on mouseup
downloadFiles
end mouseup

on downloadFiles
put the milliseconds into startTm
libUrlDownloadToFile "validdomain/test.zip", specialfolderpath ("documents") & "/test.zip","downComplete"
answer the milliseconds - startTm
end downloadFiles

on downComplete
answer "downloaded"
end downComplete

domp
Posts: 3
Joined: Fri Sep 27, 2013 4:09 am

Re: libUrlDownloadToFile callback message not working in and

Post by domp » Tue Oct 01, 2013 7:57 am

Found this under General Engine features for mobile.

libUrlDownloadToFile url, filename

Unlike the libUrl command of the same name, this command blocks until the download is complete, and notifies progress through the urlProgress message as described above.



Would have been helpful if it was also in the dictionary definition :) Anyway, happy to get back to coding.

cheers

Dom

Post Reply