Last active
January 13, 2020 11:50
-
-
Save ubarua123/985379f22ac11bcac09594a6554adcbd to your computer and use it in GitHub Desktop.
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 { | |
// Our custom parameter | |
private final Retrofit retrofit; | |
@Inject | |
public SampleWorker( | |
@NonNull Context context, | |
@NonNull WorkerParameters parameters, | |
Retrofit retrofit) { | |
super(context, parameters); | |
this.retrofit = retrofit; | |
} | |
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