質問

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?

役に立ちましたか?

解決

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

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top