DEV Community

loading...

for a moment i decide to migrate to retrofit from volley in Android but then....

artaaaw profile image Arta Mohamadi ・1 min read

i upload backend code to server then i decided to test
application and then i notice every new record that i post In the form of dublicate saved in database.....
here some weird occur,
i checked backend code severals time and debuggin android part but there is now failure or any bug but also my record some time duplicated in db.
then with using Log.i() i notice that double (or some time third) request sent from application to server.... -_____-
i thougt mybe this weird act is about volley and i have to use retrofit insetad of it.
but also we have to know that one of my parameter that would sent to server was image(base64))
then finaly(after 2 days) i noticed that this is not my fault actually or about my backend code this is about process of volley==> if volley start to send or get some request from specefic to URL then dont recive any response in same time again dublicated its request to that URL(Not diffrent between GET or POST,this process caused my problem)these event occur bucause one of my parameter that related to image(because size of image)
later i notice we have Retry Policy in volley that we can config it in that one request send to url(until if dont recive response in same time)then it allows backend process image as fine.
finally im happy now :)
sorry if this text have strange grammerly my english is easy weak but also in progress... :)
tnx for reading.

Discussion (0)

Forem Open with the Forem app