Skip to content

Instantly share code, notes, and snippets.

@DHosseiny
Created May 26, 2023 13:35
Show Gist options
  • Save DHosseiny/f13c0a2fd00b327912d3dcacaf4d7124 to your computer and use it in GitHub Desktop.
Save DHosseiny/f13c0a2fd00b327912d3dcacaf4d7124 to your computer and use it in GitHub Desktop.
MyApplication3
@HiltAndroidApp
class MyApplication : Application(), Configuration.Provider {
@Inject
lateinit var hiltWorkerFactory: HiltWorkerFactory
private val workerProviders =
HashMap<Class<out ListenableWorker>, Provider<AssistedWorkerFactory>>()
override fun getWorkManagerConfiguration(): Configuration {
return Configuration.Builder().setWorkerFactory(
AggregatorWorkerFactory(
hiltWorkerFactory, DaggerWorkerFactory(workerProviders)
)
).build()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment