我几个月前开发了一些Android应用程序项目,其中包括:
我在真实设备上遇到的异常是:ConnectionTimeOutException。
我想知道发生了什么错误,以便解决这个问题。我不确定我应该发布哪些更多的信息。如果需要请告诉我。
- GCM功能
- Webservice调用
我在真实设备上遇到的异常是:ConnectionTimeOutException。
我想知道发生了什么错误,以便解决这个问题。我不确定我应该发布哪些更多的信息。如果需要请告诉我。
AsyncTask<Void, Void, Boolean> gettingHttpOTP = new AsyncTask<Void, Void,Boolean>(){
HttpResponse httpresponse;
HttpClient client ;
JSONObject objSendjson;
HttpPost post ;
HttpEntity entity;
String result;
JSONObject objRetrievejson;
@Override
protected Boolean doInBackground(Void... arg0) {
client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 50000);
objSendjson = new JSONObject();
try
{
post = new HttpPost(Configurations.API_VERIFY_END_USER);
objSendjson.put("Mobile_Number", gCountryCodeAndMobileNumber);
objSendjson.put("Signature_Key", Configurations.SIGNATUREKEY);
post.setHeader("Content-type", "application/json");
post.setEntity(new StringEntity(objSendjson.toString(), "UTF-8"));
httpresponse = client.execute(post);
entity = httpresponse.getEntity();
gHttpResponseCode=httpresponse .getStatusLine().getStatusCode();
if(gHttpResponseCode==200)
{
gResponseText = EntityUtils.toString(entity);
objRetrievejson=new JSONObject(gResponseText);
gRecievedJsonOutput=objRetrievejson.getString("Result_Output");
gRecievedJsonDescription=objRetrievejson.getString("Result_Message");
gRecievedJsonCode=objRetrievejson.getString("Result_Code");
gRecievedJsonStatus=objRetrievejson.getString("Result_Status");
}
else
{
gResponseText=null;
}
}
catch(Exception errorException)
{
Log.d("Exception generated with response code = "+gHttpResponseCode,""+
errorException);
}
return null;
}
我的网络服务正在互联网上运行,我尝试使用不同的ISP
编辑(2015年5月4日):
我不知道是什么原因导致了这个问题,但我没有更改任何代码,现在它又可以正常工作了。