Last active
January 13, 2020 07:16
-
-
Save ubarua123/f6803b9cdaef3ff8930f80016ccbb2a3 to your computer and use it in GitHub Desktop.
WorkManager worker class sample
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 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