[RESOLVED] Unable to get Network phases in network.download request using progress = true

Hello,

Having an issue here. I’m trying to download 5 images then load the download paths into a table and feed it into an image slider. I’ve managed to do this, however, on 3G, the amount of images is inconsistent. One load will be 2 images total, the next 5, the next 3, etc. 

Below is new code I’m working on, I’m trying to set it up so that when one listener detects an image is downloaded(I presume with the ‘ended’ event phase), I begin downloading the next, as I read multiple concurrent downloads can have issues. However, my listener function never registers a phase of any kind, only return nil if I print out event.phase. 

Am I missing something here? Progress is set to true in the params slot of network download, as mentioned in the api, so I should be getting phases, yes? I would appreciate any insight.

local fetch = function(name, path) local function networkListener( event ) if ( event.isError ) then print ( "Network error - download failed" ) elseif ( event.phase == "began" ) then print("Began") elseif (event.phase == "progress") then print("progressing...") elseif (event.phase=="ended") then print("ended") end print(event.response) end network.download( path, "GET", networkListener, {progress = true}, name, system.TemporaryDirectory ) end

The setting for progress should not have an effect on getting began/ended phases.  Try putting a print before your if statement hat prints out the event.phase.

Done. It’s returning Nil.

Can you print out what you’re getting for name and path?

Here are the values for name and path that are passed into the function for this example. I’ve withheld certain info on behalf of my employer.

name   =     DK-80171_V1.jpg

path     =     http://images.**********.com/images/product/shoes/DK-80171_V1.jpg

It might be worth noting that the image path I get back does resolve to the image.

I printed out the event.response also:

/Users/****/Library/Application Support/Corona Simulator/DK_1-8417F48BDC8BFFA0C8BEE0D9FA202B85/tmp/DK-80171_V1.jpg

I just got the most recent daily build and it is now working. Case closed.

The setting for progress should not have an effect on getting began/ended phases.  Try putting a print before your if statement hat prints out the event.phase.

Done. It’s returning Nil.

Can you print out what you’re getting for name and path?

Here are the values for name and path that are passed into the function for this example. I’ve withheld certain info on behalf of my employer.

name   =     DK-80171_V1.jpg

path     =     http://images.**********.com/images/product/shoes/DK-80171_V1.jpg

It might be worth noting that the image path I get back does resolve to the image.

I printed out the event.response also:

/Users/****/Library/Application Support/Corona Simulator/DK_1-8417F48BDC8BFFA0C8BEE0D9FA202B85/tmp/DK-80171_V1.jpg

I just got the most recent daily build and it is now working. Case closed.