Android Retrofit OkHttp Offline Caching [Source code]
In this Project, we’ll be discussing and implementing Offline caching in our android application.
We’ll be using Retrofit and Okhttp libraries.
Opening your application with no internet and seeing no previous data is a very common occurrence.
Two ways to deal with loading network requests that come first to our minds are:
- Shared Preferences
Using either of them comes with its fair share of cons (and more code to write).
While Adding Data in SharedPreferences is easy. It’s time-consuming to retrieve the required data. Plus scalability is an issue.
SQLite with tables makes it hard to do many changes in the future. Plus SQLite operations are heavy.