Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ThePredators's full-sized avatar
🎯
Focusing

Sbe-ng ThePredators

🎯
Focusing
View GitHub Profile
@ThePredators
ThePredators / AndroidWorkerInjection.java
Last active December 30, 2021 03:27
[Dagger] integration with workers (For Java People)
public class AndroidWorkerInjection {
public static void inject(Worker worker) {
checkNotNull(worker, "worker");
Object application = worker.getApplicationContext();
if (!(application instanceof HasWorkerInjector)) {
throw new RuntimeException(
String.format(
"%s does not implement %s",
application.getClass().getCanonicalName(),