1

I tried many wifi and mobile data but it's issue just on my mobile. Whenever i try to send a volley request get a timeout error. I don't know why just my device is causing this issue. Can anyone explain this?

1 Answers1

0

Maybe it's related to different speed in wifi and mobile data network. you can use a large timeout value, try this:

int socketTimeout = 40000; // set 40 seconds timeout value
RetryPolicy policy = new DefaultRetryPolicy(socketTimeout,                 
                                            DefaultRetryPolicy.DEFAULT_MAX_RETRIES,     
                                            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);

Then set this setting to request queue:

postRequest.setRetryPolicy(policy);
AppController.getInstance().addToRequestQueue(postRequest);

I hope it is useful

Pooya Chavoshi
  • 346
  • 4
  • 12