Skip to content

Instantly share code, notes, and snippets.

@ubarua123
Last active January 13, 2020 07:16
Show Gist options
  • Save ubarua123/f6803b9cdaef3ff8930f80016ccbb2a3 to your computer and use it in GitHub Desktop.
Save ubarua123/f6803b9cdaef3ff8930f80016ccbb2a3 to your computer and use it in GitHub Desktop.
WorkManager worker class sample
public class SampleWorker extends RxWorker {
public SampleWorker(
@NonNull Context context,
@NonNull WorkerParameters parameters) {
super(context, parameters);
}
public Single<Result> createWork() {
// Create a single observer which will hit a url and nothing else.
return Observable.range(0, 100)
.flatMap { download("https://www.google.com") }
.toList()
.map { Result.success() };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment