Congratulation With New Funny :( Bug With Network 2.0 "post" Request On Android!

I have further narrowed it down to missing data in the event passed into my listener.

For example, when I POST something succesfully from the simulator or from an iOS device, I get back this as the event table:

{     responseHeaders =     {         Access-Control-Allow-Origin = "\*",         Content-Type = "application/json; charset=utf-8",         Date = "Tue, 23 Apr 2013 02:48:52 GMT",         Set-Cookie = "\_parse\_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRiIlNWQ4ZjMyZTlmNWRiMDQxYTAyM2ViMjZiMDIyMmYyYTQ%3D--39d76bd6cbdf29c9f6ea923befeaffa47411b0bd; domain=.parse.com; path=/; expires=Sun, 23-Apr-2023 02:48:52 GMT; secure; HttpOnly",         Access-Control-Request-Method = "\*",         Status = "201 Created",         Location = "https://api.parse.com/1/classes/Game/VfsDRgyzkN",         Cache-Control = "no-cache",         Connection = "keep-alive",         X-Runtime = "0.058573",         Content-Length = "64",         X-UA-Compatible = "IE=Edge,chrome=1",         Server = "nginx/1.2.2",     },     responseType = "text",     phase = "ended",     bytesEstimated = 64,     response = "{"createdAt":"2013-04-23T02:48:52.895Z","objectId":"VfsDRgyzkN"}",     name = "networkRequest",     bytesTransferred = 64,     status = 201,     url = "https://api.parse.com/1/classes/Game",     isError = false,     requestId = userdata: 0x109315fb8, }  

Note how the response var has something in it:

response = “{“createdAt”:“2013-04-23T02:48:52.895Z”,“objectId”:“VfsDRgyzkN”}”

Now, on Android I get nothing back in the response var even though the POST suceeded:

{     responseHeaders =     {         Access-Control-Allow-Origin = "\*",         Content-Length = "64",         X-UA-Compatible = "IE=Edge,chrome=1",         X-Runtime = "0.220905",         Date = "Tue, 23 Apr 2013 02:43:42 GMT",         Set-Cookie = "\_parse\_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRiIlYmVmZWUzNzUzODhiMDkwY2IxNWY1NjRlZmE3NTdiYzc%3D--37c47909943ae8189d856595df066364392aca85; domain=.parse.com; path=/; expires=Sun, 23-Apr-2023 02:43:42 GMT; secure; HttpOnly",         Access-Control-Request-Method = "\*",         X-Android-Sent-Millis = "1366771317313",         Connection = "keep-alive",         Status = "201 Created",         Cache-Control = "no-cache",         X-Android-Received-Millis = "1366771318017",         Location = "https://api.parse.com/1/classes/Game/TVPJIwJGno",         Content-Type = "application/json; charset=utf-8",         HTTP-STATUS-LINE = "HTTP/1.1 201 Created",         Server = "nginx/1.2.2",     },     responseType = "text",     phase = "ended",     bytesEstimated = 0,     response = "",     name = "networkRequest",     bytesTransferred = 0,     status = 201,     url = "https://api.parse.com/1/classes/Game",     isError = false,     requestId = false, }  

Does anyoine have a clue why this would be? This code has been working perfectly for over 6 months, but now I get no data back an Android.

The next Daily Build (2013.2094 or later) should fix the problem with 201 responses which were being treated slightly differently to those with 200 codes.

This was the only problem I was able to find POSTing data on Android after a bunch of testing.  If still have problems using the fixed build, please send us a reproducible case and note the device and Android version you are seeing the error on.

Thanks. My Android builds are back to working as of build 2013.1094.

Hello, I have also the same problem but i m not a pro member. Could you tell me when it is the next release with this bug fix? Thanks.

Hello, I have also the same problem but i m not a pro member. Could you tell me when it is the next release with this bug fix? Thanks.

I don’t want to bother but can I get an answer about when the public release will include this bug fix ?
Because the more I work on my game the more I need to implement a temporary dirty solution to avoid this bug.

Thanks.

From history, they’re usually about 6 month apart I think.

We’re finalizing a Public Release at the moment.  I can’t say exactly when it will be available because we might still find a showstopper but you can assume it’ll be Real Soon Now.

Great news ! Thanks !

I have a similar problem with network.download GET request.

Basically what we do is uploading a .txt on dropbox. This .txt contains the base64 converted binary data of an image.
Then, we want to retrieve this data, and we do so through a .download request, to save it in a .txt file in the Documents Directory. 

On iOS and simulator, everything works fine. 
On Android, event.response is always nil. This on the latest build.

Any thoughts?

UPDATE:
fixed. For some reason on android parse.com reports code 302 (redirect) for retrieving files.
Just take the url in responseHeader.Location and redo the call with it (:

I don’t want to bother but can I get an answer about when the public release will include this bug fix ?
Because the more I work on my game the more I need to implement a temporary dirty solution to avoid this bug.

Thanks.

From history, they’re usually about 6 month apart I think.

We’re finalizing a Public Release at the moment.  I can’t say exactly when it will be available because we might still find a showstopper but you can assume it’ll be Real Soon Now.

Great news ! Thanks !

I have a similar problem with network.download GET request.

Basically what we do is uploading a .txt on dropbox. This .txt contains the base64 converted binary data of an image.
Then, we want to retrieve this data, and we do so through a .download request, to save it in a .txt file in the Documents Directory. 

On iOS and simulator, everything works fine. 
On Android, event.response is always nil. This on the latest build.

Any thoughts?

UPDATE:
fixed. For some reason on android parse.com reports code 302 (redirect) for retrieving files.
Just take the url in responseHeader.Location and redo the call with it (:

The code below works in IOS but just returns network Error when testing on an Android device. I have the latest build - CoronaSDK 2013.1171 -. From the above dialog it was just a build issue but it still does not work.

My  build settings contain:

            “android.permission.INTERNET”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            “android.permission.ACCESS_FINE_LOCATION”,

            “android.permission.ACCESS_COURSE_LOCATION”,

Any ideas?

Thanks


local function networkListenerLamp( event )

        if ( event.isError ) then

               print( “Network error!”)

              native.showAlert( “Network Error!”, “Status: Try Again.”, { “OK” } )

        else

                print ( "RESPONSE: " … event.response )

                   end

               end


local function LampHttp()

 colortype ="#000000"


headers = {}

headers[“Content-Type”] = “application/json”

headers[“Accept-Language”] = “en-US”

body = ‘{“program”: "’ … programtype … ‘",“color”: "’ … colortype … ‘"}’ 

–*******************************

local params = {}

params.headers = headers

params.body = body

network.request( “https://agent.electric.com/”…_G.Accountt , “POST”, networkListenerLamp,  params)

end

I always get an error for https://agent.electric.com :

curl: (6) Couldn’t resolve host ‘agent.electric.com

Getting “isError” set is what I would expect in Corona.  I don’t know why it appears to work for you in iOS.

My question was there any syntax difference for Android and IOS that would cause the networkListenerLamp error.

The URL was bogus because the actual is attached to an account.

Bottom line I go it to work by asking the server to specify in their header what the Content-Type was. IOS is forgiving on Content-Type but Android is not. Thank you for your input.

The code below works in IOS but just returns network Error when testing on an Android device. I have the latest build - CoronaSDK 2013.1171 -. From the above dialog it was just a build issue but it still does not work.

My  build settings contain:

            “android.permission.INTERNET”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            “android.permission.ACCESS_FINE_LOCATION”,

            “android.permission.ACCESS_COURSE_LOCATION”,

Any ideas?

Thanks


local function networkListenerLamp( event )

        if ( event.isError ) then

               print( “Network error!”)

              native.showAlert( “Network Error!”, “Status: Try Again.”, { “OK” } )

        else

                print ( "RESPONSE: " … event.response )

                   end

               end


local function LampHttp()

 colortype ="#000000"


headers = {}

headers[“Content-Type”] = “application/json”

headers[“Accept-Language”] = “en-US”

body = ‘{“program”: "’ … programtype … ‘",“color”: "’ … colortype … ‘"}’ 

–*******************************

local params = {}

params.headers = headers

params.body = body

network.request( “https://agent.electric.com/”…_G.Accountt , “POST”, networkListenerLamp,  params)

end

I always get an error for https://agent.electric.com :

curl: (6) Couldn’t resolve host ‘agent.electric.com

Getting “isError” set is what I would expect in Corona.  I don’t know why it appears to work for you in iOS.