Demonstrates behavior with values of 'Cache-Control' response headers on Android using Retrofit/OkHttp. For more info and explanations of how 'Cache-Control' response header values affect your apps, see Use Your Headers
See the blog post entry on how to perform the forensics on viewing cache data in the emulator.
The source code for the fake API is also located in Github, but is deployed to Google App Engine (see "urlBase" in the view model.) The backend will frequently spin down to zero instances, so when executing the demo, allow a few seconds for the backend to launch.
I've generated the classes in the apis
, infrastructure
and models
folders using the OpenAPI generator, which accepts OpenAPI (formerly Swagger) documentation URLs and produces generated client code.
The command for generating these is
openapi-generator generate -g kotlin --additional-properties packageName=com.diveinsoft.blog.headers,library=jvm-retrofit2,serializationLibrary=gson --skip-validate-spec -i http://localhost:8080/v3/api-doc
.
You can also use the GAE-hosted URL to generate these files, as well.