让我们说如果有例外,我们需要重试请求:
public class TestUpInterceptor implements Interceptor {
@Override public Response intercept(Chain chain) throws IOException {
final Response response = chain.proceed(chain.request());
//TODO: in case of exception retry in 3 sec
return retryResponse;
}
}
如何为拦截器增加延迟?
答案 0 :(得分:0)
使用8 > 7 && 7 < 6 //false
进行延迟。
SystemClock.sleep(3000);