Im trying to get some response text (xml to be precise) from a server in my AIR app. If i send a GET request to the server, it should send me back some XML so i can process it. This is all done via a Mobile Application in AIR.
It runs perfectly on my PC but as soon as i try it on my Android Tablet, it just doesnt work.
What ive tracked it down to, is for some reason, as soon as i put a method typee such as POST or GET, into the URLRequest object, it just doesnt return any data. And i cant figure out why its not returning data.
Heres the code:
private function login(url:String):void
var req:URLRequest = new URLRequest(url);
var loader:URLLoader = new URLLoader();
req.data = "";
req.method = URLRequestMethod.POST;
Just doesnt make sense why it would not return data, if i run it on my mobile device.
can you check if "INTERNET" Android permissions is selected in your project settings? (or check it manually in your app.xml):
it does not return data - but does it reach server? (are you able to log that?)
Theres def no errors.
Im using Flash Builder 4.5 and when im debugging it, the target data is just empty.
Its like its sending back nothing.
Ive got internet permissions on and it seems to be reaching the server.
Whats strange is that if i dont give it a "method" such as POST, it actually does return the XML.
The problem i now have is, i need to use POST/PUT as i have to invoke something on the server.
So it appears that when i send a POST request msg, thats when it doesnt return anything, when it should.
Ive gotten a bit further and it seems that the POST request actually does work, its invoking an action on the server.
Its just that it returns no data on a mobile device, but returns xml when running on a PC.
I know this is probably 2 years too late for you, but figured I'd post as someone appears to have figured out what the solution may be.
When I was debugging this, I was pinging https://parse.com. When I tried google, everything seemed to work, so initially I thought it was Parse's servers doing something strange. I then tried https://www.facebook.com to check if it was something to do with the ssl. So when I did this, I got the same issue as with Parse. Finally able to narrow down what I was googling for I came across a post over at stackoverflow.
So apparently the issue is with the captive runtime. I have yet to try using the updated 3.8 AIR SDK (going to try that soon), but using the captive runtime compiled with the 3.8 SDK may be a solution to this problem. If that doesn't work, just try to package your Android apps without the captive runtime and get the end user to install the AIR package separately (not an optimal solution, but may work for most).