Skip to content

Instantly share code, notes, and snippets.

@pfmaggi
Created March 31, 2020 17:29
Show Gist options
  • Select an option

  • Save pfmaggi/b61a33db6a26810b0db3c86e7a82430c to your computer and use it in GitHub Desktop.

Select an option

Save pfmaggi/b61a33db6a26810b0db3c86e7a82430c to your computer and use it in GitHub Desktop.
Code for the Medium article: "Customizing WorkManager"
/* Copyright 2020 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
class MyApplication : Application(), Configuration.Provider {
override fun getWorkManagerConfiguration(): Configuration {
val myWorkerFactory = DelegatingWorkingFactory()
myWorkerFactory.addFactory(MyWorkerFactory(service))
// Add here other factories that you may need in your application
return Configuration.Builder()
.setMinimumLoggingLevel(android.util.Log.INFO)
.setWorkerFactory(myWorkerFactory)
.build()
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment