Java Code Examples for io.reactivex.Observable.timer()

The following are Jave code examples for showing how to use timer() of the io.reactivex.Observable class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: AndroidMVPresenter   File: MainPresenter.java   Source Code and License Vote up 6 votes
public MainPresenter(final AuthRepo authRepo) {
    super();
    this.authRepo = authRepo;

    super.setupRetry(
            3,
            new Function<Throwable, Observable<?>>() {
                @Override
                public Observable<?> apply(Throwable throwable) throws Exception {
                    if (throwable instanceof AuthentificationException && ((AuthentificationException) throwable).statusCode == 401) {
                        return authRepo.authentificate().toObservable();
                    } else if (throwable instanceof IOException) {
                        return Observable.timer(3, TimeUnit.SECONDS); //wait 3 seconds before continue
                    }
                    return Observable.error(throwable);
                }
            });
}
 
Example 2
Project: GitHub   File: TimerExampleActivity.java   Source Code and License Vote up 4 votes
private Observable<? extends Long> getObservable() {
    return Observable.timer(2, TimeUnit.SECONDS);
}
 
Example 3
Project: RxJava2-Android-Sample   File: TimerExampleActivity.java   Source Code and License Vote up 4 votes
private Observable<? extends Long> getObservable() {
    return Observable.timer(2, TimeUnit.SECONDS);
}