2

So I'm using cocos2dx's HTTPRequest and here is my sample code:

cocos2d::network::HttpRequest * request=new cocos2d::network::HttpRequest();
        request->setUrl(strUrl.c_str());
        request->setRequestType(cocos2d::network::HttpRequest::Type::GET);
        request->setResponseCallback(CC_CALLBACK_2(HttpAvatar::onDownloadComplete, this));
        request->setTag("GET My Data");
        request->setUserData(info);
        cocos2d::network::HttpClient::getInstance()->send(request);
        request->release();


It works well on iOS. But in android, it keeps on failing. I always get a response code value of -1. Has anyone experienced this before? How do I fix this? Thank you.

cessmestreet
  • 2,298
  • 3
  • 22
  • 42
  • Did you set your permissions for Android? Do you know what the -1 message means? – NinjaBeetle Apr 03 '16 at 14:46
  • Hi NinjaBeetle. I did set the permission. I really don't know what it means aside from the fact that it's the default value of the error code in cocos2dx. I'm closing this because I found out that it was due to our request not being able to reach through the server as we are trying to access it using external network when we should be using internal. Thanks. – cessmestreet Apr 04 '16 at 03:04

0 Answers0