Blocking network.request option

What is the best approach in the current framework to generate a *blocking* network.request?

I have data that I need to POST (https) to my server onSystemEvent applicationExit. When using the async network.request(), I get intermittent results. Most of the time the data is not POSTed.

Is there an “unsupported” way to have it block, or some other type of backdoor in the API?

Other suggestions?

Thanks for any insight.

-Dave [import]uid: 1989 topic_id: 29001 reply_id: 329001[/import]

Could you file a bug report with sample to reproduce, please? (Am not seeing this in system either.) [import]uid: 52491 topic_id: 29001 reply_id: 116891[/import]

Any suggestions here?

I also noticed that the same thing occurs with applicationSuspend. When applicationResume is triggered, the previous network request in applicationSuspend completes, followed by the new request in applicationSuspend

What techniques do people use to utilize network.request() and more importantly, handle the response, when the application suspends or exits?

I’m fairly stymied here. It seems callbacks aren’t fully working in these events listeners.

[blockcode]
local serviceUrl=“http://company.com/echo_post
local responseText=display.newText("",150,50 )

local function postListener(event)
print(“Response: " … event.response)
print(”-----------------------")
print("\n")
responseText.text = event.response
end
local function onSystemEvent( event )
print( “System event name and type: " … event.name, event.type )
local postData={
type = event.type
}
local params={}
params.body=“event=”…event.type
network.request(serviceUrl…”/"…event.type,“POST”,postListener,params)
end
Runtime:addEventListener( “system”, onSystemEvent )
[/blockcode]

[blockcode]

<?php
print\_r($\_POST); ?\> [/blockcode] I understand that the display object may not update, that seems normal -- but tailing my log file, it's apparent that the request is never even sent in those states. Works fine from the term/sim. There was a similar bug report about this in the old forum, but saw no history of it in the new bug system: http://developer.coronalabs.com/forum/2012/07/06/networkrequest-not-possible-applicationsuspend-event I even tried the daily builds from yesterday, same issue. [import]uid: 1989 topic\_id: 29001 reply\_id: 116829[/import]

Done. Case #15957.

Thanks, peach. [import]uid: 1989 topic_id: 29001 reply_id: 116903[/import]

Great, just had a look and this has been assigned to Danny so you should hear from him shortly :slight_smile:

Peach [import]uid: 52491 topic_id: 29001 reply_id: 116990[/import]