Best way to repeat an observable every minute rxjava

you can use interval() oberator here is the code

DisposableObserver<Boolean> disposable = 
Observable.interval(1, TimeUnit.MINUTES)
            .flatMap(aLong -> isPinSet().toObservable())
            .subscribeOn(Schedulers.io())
            .subscribeWith({isPinSet -> doSomething()}, {throwable -> handleError()}, {});

if you want to finish this operation at any time call disposable.dispose()


Try .repeatWhen(objectFlowable -> Flowable.timer(10, TimeUnit.SECONDS).repeat())


Try this:

parentalControlInteractor.isPinSet()
        .subscribeOn(Schedulers.io())
        .repeatWhen(new Func1<Observable<? extends Void>, Observable<?>>() {
            @Override
            public Observable<?> call(Observable<? extends Void> observable) {
                return observable.delay(60, TimeUnit.SECONDS);
            }
        })
        .doOnError(throwable -> {
            Timber.e(throwable,"Error getting if Pin is set");
            throwable.printStackTrace();
        })
        .subscribe(isPinSet -> {
            this.isPinSet = isPinSet;
            Timber.d("Pin is set = " + isPinSet.toString());
        });