Android Volley Sending data twice

When you use Android Volley Library to make a http post request, the default situation is that the data will be send twice.

In order to avoid this, you would need to add the line 2 of the below code to set the retry policy.


JsonObjectRequest jsonObjReq = new JsonObjectRequest(...);
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

Reference: https://stackoverflow.com/questions/27873001/android-volley-sending-data-twice

This entry was posted in Android, Java and tagged , , , , . Bookmark the permalink.

Leave a comment