Injecting class into a service
I'm developing an android app, and I'm using MVVM pattern with Dagger, Databinding, etc.
Currently I have a network layer called DataManager which injects in every ViewModel. This Datamanager class is the one who makes request to my server.
It look like this
@Singleton
class DataManager @Inject constructor(context: Context, private val sharedPreferences: ISharedPreferences, private val apiHelper: APIHelper) : IDataManager {
...
}
Everything works fine with fragments/activies...