Created
July 13, 2022 18:08
-
-
Save DivS-15/923e447f0b9b5af71068d7d614f5698d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
@InstallIn(SingletonComponent::class) | |
object WorkManagerInitializer : Initializer<WorkManager> { | |
@Provides | |
@Singleton | |
override fun create(@ApplicationContext context: Context): WorkManager { | |
val configuration = Configuration.Builder().build() | |
WorkManager.initialize(context, configuration) | |
Log.d("Hilt Init", "WorkManager initialized by Hilt this time") | |
return WorkManager.getInstance(context) | |
} | |
override fun dependencies(): List<Class<out Initializer<*>>> { | |
// No dependencies on other libraries. | |
return emptyList() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment