In my Android application I run a http post
and I get timeout
exception when i am connected via 3G/4G
and not via wifi (I send images but this happened with images of 1 Kb as well, the problem it's not the size of image, I am sure about this).
Here the code.
I use Android Asynchronous Http Client
Thanks in advance.
AsyncHttpClient httpClient = new AsyncHttpClient();
RequestParams requestParams = new RequestParams();
httpClient.setTimeout(25000);
httpClient.setConnectTimeout(25000);
httpClient.setResponseTimeout(25000);
destination = new File(path);
requestParams.put("file", destination);
httpClient.post("http://" + serverUrl + ":8081/readplate", requestParams, new JsonHttpResponseHandler() {
@Override
public void onFailure(int statusCode, Header[] headers, java.lang.Throwable throwable, org.json.JSONObject response) {
//exception here
...
}
@Override
public void onSuccess(int statusCode, Header[] headers, org.json.JSONArray response) {
...
}
}