Recently I am exploring Android Architecture, that has been introduced recently by google. From the Documentation I have found this:
public class MyViewModel
Take a look at the Android architecture guide that accompanies the new architecture modules like LiveData
and ViewModel
. They discuss this exact issue in depth.
In their examples they don't put it in a service. Take a look at how they solve it using a "repository" module and Retrofit. The addendums at the bottom include more complete examples including communicating network state, reporting errors, etc.