Rx.Single timer
Thu, Jun 23, 2016The timer processing introduce the following two of Pattern in Rx.Single.
Repeat until OnError
callSingle().toObservable()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.repeatWhen { it.flatMap({ Observable.timer(50, TimeUnit.SECONDS)}) }
.subscribe({
doStuff()
})
Repeat until OnSuccess
callSingle().toObservable()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.retryWhen { it.flatMap({ Observable.timer(50, TimeUnit.SECONDS)}) }
.subscribe({
doStuff()
})
There is a need to convert once from Single to Observable