janishar/android-mvvm-architecture

How to make parallel api calls in a class using Rxjava

Harmeetkaur01 opened this issue · 1 comments

Hi @amitshekhariitbhu ,
I want to call 4 API's at a time. I'm having problem while calling multiple API's at a screen in parallel using Rxjava, could u please provide a syntax or a small demo for help. This is how I 'm making a single network call using Rx:

getCompositeDisposable().add(getDataManager().getUserInfo()
                .subscribeOn(Schedulers.io())
                .observeOn(Schedulers.ui())
                .subscribe(userInfoResponse,throwable);
 public Single<ApiResponse> getUserInfo() {
            return Rx2AndroidNetworking.get(strUrl)
                    .addHeaders(mApiHeader)
                    .build()
                    .getObjectSingle(ApiResponse.class);
    }