The problem exactly like the following I have one api which can provide some data and one apk,
I got my api response with my device and another different old response on the emulator with the same apk!
The emulator response is up to date with the latest changes while the other different response is before the changes.
The app uses retrofit without caching. So what could be the problem?
Request contains only one header (access token) Response contains headers like (ETag, Access-Control-Max-Age) but retrofit should not deal with them as there is no cache at all.
Also when waiting for a while all devices become up to date!
2 Answers
Answers 1
Are you sure with this?
The app uses retrofit without caching
Based on this https://github.com/square/retrofit/issues/678, I think that retrofit (OkHttp inside retrofit) caching your query.
You can change this behavior by 2 ways:
- add ?_t=TIMESTAMP into your app query url
- remove 'Access-Control-Max-Age' header from your server response
Answers 2
Or you can create new OkHttp client to retrofit and write something like that:
new OkHttpClient.Builder().cache(null).build(); or
Request.cacheControl(CacheControl.FORCE_NETWORK) 
0 comments:
Post a Comment