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?
Actually I am using service that extends RetrofitGsonSpiceService. The code of my service class is below:
public class MyService extends RetrofitGsonSpiceService {
@Override
public void onCreate() {
super.onCreate();
addRetrofitInterface(MyInterface.class);
}
@Override
public CacheManager createCacheManager(Application application) throws CacheCreationException {
CacheManager cacheManager = new CacheManager();
ObjectPersisterFactory persistFactory = new RetrofitObjectPersisterFactory(application,
getConverter(), getCacheFolder());
persistFactory.setAsyncSaveEnabled(true);
cacheManager.addPersister(persistFactory);
return cacheManager;
}
@Override
protected String getServerUrl() {
return Utils.getBaseUrl();
}
@Override
protected RestAdapter.Builder createRestAdapterBuilder() {
RestAdapter.Builder builder = new RestAdapter.Builder().setRequestInterceptor(
new RequestInterceptor() {
@Override
public void intercept(RequestFacade request) {
request.addHeader(Const.HEADER_DEVICE_TYPE_KEY,
Const.HEADER_DEVICE_TYPE_VALUE);
}
}
);
builder.setEndpoint(getServerUrl()).setConverter(getConverter());
return builder;
}
}