I wanted to download a list of images from the web, using network.loadRemoteImage, network.download, & network.request work perfectly well on iOS & Simulator, but not for Android.
These are the sample images that not working well on Android(Nexus 5 & Samsung Galaxy Duo):
These images can load perfectly well on any browser, iOS device & simulator (using network method above), but for Android, it shows status 400.
Using Curl, some returns “document moved”, with new url
This is the code i used:
local function networkImageListener(event) -- do something end display.loadRemoteImage(url, "GET", networkImageListener, fileName, system.CachesDirectory)
here comes the interesting part:
After all the network method above failed, I try to implement using socket.http, which successfully downloaded ALL images, with only 1 major drawback – not async.
I searched the WHOLE internet, found a little old implementation to make socket.http call become async, but not working, maybe not compatible anymore. Some with missing link (http://developer.coronalabs.com/code/cross-platform-asynchronous-http-request)
So, any potential solution I can have?