<How to inject SharedPreferences to Background ser...
# stackoverflow
u
How to inject SharedPreferences to Background service using Hilt I am trying to inject SharedPrefernces to Timer foreground service class. I use @EntryPoint annotation over service class. ApplicationModule class @Module @InstallIn(SingletonComponent::class) class ApplicationModule() { @Singleton @Provides fun provideSharedPreferences(@ApplicationContext appContext: Context): SharedPreferences { return PreferenceManager.getDefaultSharedPreferences(appContext) } } Timer service class @EntryPoint class Timer : Service() { @Inject lateinit...