Hi I am using Volley for Networking in Android , Everything is working fine the problem is on Slow Internet Error , where time out happens but request sent to server some time it is getting processed . Can someone help me out , Even i tried increasing timeout but nothing is helpful.
Asked
Active
Viewed 1,364 times
0
-
Try this https://stackoverflow.com/questions/21011279/android-volley-checking-internet-state – Ankita Oct 03 '17 at 11:41
-
https://stackoverflow.com/questions/17094718/change-volley-timeout-duration – Vij Oct 03 '17 at 11:47
-
Hi Ankita Thanks for your suggestion , i can able to catch that Slow Internet issue but problem is sometime it is being sent to server and processed.Consider in case of signup , i am showing slow internet connection but user is added in database. – Shanmugam Oct 03 '17 at 11:47
-
@Shanmugam did you add `TimeoutError ` ? – IntelliJ Amiya Oct 03 '17 at 12:00
-
@IntelliJ Amiya i added , when internet is slow request is sent to server , any way to block it? – Shanmugam Oct 03 '17 at 12:10
-
@Shanmugam if `TimeoutError ` coming then you can exit task easily – IntelliJ Amiya Oct 03 '17 at 12:13
-
1@ IntelliJ Amiya Thanks... – Shanmugam Oct 03 '17 at 12:27
-
@IntelliJ Amiya i solved my increasing Time out duration.. – Shanmugam Oct 04 '17 at 05:46
2 Answers
2
@Override
public void onErrorResponse(VolleyError volleyError) {
String message = null;
if (volleyError instanceof NetworkError) {
message = "Cannot connect to Internet...Please check your connection!";
} else if (volleyError instanceof ServerError) {
message = "The server could not be found. Please try again after some time!!";
} else if (volleyError instanceof AuthFailureError) {
message = "Cannot connect to Internet...Please check your connection!";
} else if (volleyError instanceof ParseError) {
message = "Parsing error! Please try again after some time!!";
} else if (volleyError instanceof NoConnectionError) {
message = "Cannot connect to Internet...Please check your connection!";
} else if (volleyError instanceof TimeoutError) {
message = "Connection TimeOut! Please check your internet connection.";
}
}

Kishore Reddy
- 2,394
- 1
- 19
- 15
0
If it is able to write in the server database then you may get a response even after a timeout. Please put Logs in both onResposne and in onErrorResponse methods.
JsonObjectRequest myRequest = new JsonObjectRequest(Method.GET,
url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d(TAG, "Error: " + error.getMessage());
}
});

Seenu69
- 1,041
- 2
- 15
- 33