Created
January 14, 2020 06:21
This file contains hidden or 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
public class SampleApplication extends DaggerApplication { | |
@Inject | |
WorkManagerWorkFactory customWorkerFactory; // Field injection of our custom worker factory class | |
@Override | |
protected AndroidInjector<? extends DaggerApplication> applicationInjector() { | |
AppComponent component = DaggerAppComponent.builder().application(this).build(); | |
component.inject(this); | |
return component; | |
} | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
// INit our worker manager | |
WorkManager.initialize(this, new Configuration.Builder().setWorkerFactory(customWorkerFactory).build()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment