I'm try to do Android offline caching method using OkHttp. The flow is like this:
if-none-catched
to the server, and the server returns a proper ETag. My issue now is how can I store and retrieve the ETag? Does OkHttp default will handle or I need store at SQLite? I keep looking on Google about OkHttp implement ETag sample code but all I get is just normal caching method. Link I refer:
so far what I achieved is only cache for 1st time service call, but never get latest data from server anymore. Appreciate if anyone can provide some guidance or found any good example of handle ETag and if-none-catch
dynamically for OkHttp to share with. Any clarification feel free to ask.
You just need to enable OkHttp’s response cache. It’ll use the ETag if your webserver returns one.