I am trying to call Rest-APIs in android. But it gives me connection time-out error in real device most of the time. From 5 tries it return me 4 time this error.
While the same thing work perfect in Emulator. I have tried Rest-APIs calling using different techniques(Volley, HttpClient, Retrofit), but same error returned.
I have deployed Rest-APIs in GoDaddy server.
StringRequest strReq = new StringRequest(Method.GET, url,
getSuccessListener(listener), getErrorListener(listener)) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("Authorization", Authorization);
return params;
}
};
strReq.setRetryPolicy(new DefaultRetryPolicy(15 * 1000, 5,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
queue.add(strReq);