You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Module
@InstallIn(ServiceComponent::class)
abstract class ServiceContextModule {
@Binds
@MyServiceContextQualifier // <- Create a qualifier for it
abstract fun provideContext(service: Service): Context
}
or you can just inject Service where as you would use the context since they are the same (Service is a Context).
What @danysantiago said is correct, but I would say I'm not sure we really should add an @ServiceContext. It isn't clear to me that the qualifier adds value over injecting Service directly. The same could be said for @ActivityContext which I am not sure yet if I regret adding. Most code I see injects Activity directly.
Why is there no
ServiceContext
qualifier? How can one obtain the service context in a module installed inServiceComponent
?The text was updated successfully, but these errors were encountered: