Question

I have to send a background request via Volley, I have set the Retry Policy:

setRetryPolicy(new DefaultRetryPolicy(10000, 5, 2));

However when WIFI and 3G are turned of I get:

.NoConnectionError: java.net.UnknownHostException: Unable to resolve host "example.com": No address associated with hostname

immediately, is there a way to keep the retry mechanism keep retring?

Était-ce utile?

La solution

The volley retry mechanism doesn't wait, it posts all the requests as soon as possible. thus, when there is no WIFI or 3G it won't even try to post the request. Note that the source code can be modified by adding retry when there is no connection. and adding Thread.sleep() in the retry mechanism

Autres conseils

Well I think it is retrying and it is doubling the interval after each try up to 5. If you are testing with emulator you can check with wireshark if request was sent.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top