I have implemented robospice in my project and using retrofit for all api calls. For some of requests, I need to increase timeout, please let me know how can I do that?
In your RetrofitSpiceService
extending service, you'll need to override createRestAdapterBuilder()
.
@Override
protected Builder createRestAdapterBuilder() {
Builder builder = super.createRestAdapterBuilder();
builder.setClient(new CustomClient());
return builder;
}
CustomClient
is the class that you need to write yourself to supply your own timeouts. If you're using OkHttp, take a look at the default OkClient
for reference: https://github.com/square/retrofit/blob/43b7ea14e5aca1d710deccb95b79484b03e99bb9/retrofit/src/main/java/retrofit/client/OkClient.java