Android Kotlin: Forecast App 04 – Abstracting Retrofit Network Calls – MVVM Tutorial Course

Up until now we’ve created a Retrofit service to communicate with the weather API, we also created all of the pieces needed for a local database using the Room library. So, we basically have all of the data components of our app implemented, right? We can fetch data and then cache it locally, so all that’s left to do is to put it all in a repository to somehow centralize network and local data calls.

Well, while we’re really close to creating a repository, we still have one important step unfinished. We need to wrap the retrofit weather API service into a special class to create an abstraction and to give the code making network calls a better structure.

?Get the code from this tutorial?

 

Matej Rešetár
 

Matej is an app developer with a knack for teaching others. If he's not programming, making tutorials or doing other business, he's mostly working out, listening to audiobooks and taking cold showers.

>