what is the role of RxJava2CallAdapterFactory.create()...
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://api.example.com")
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();
Retrofit is a type-safe REST client for Android, Java and Kotlin developed by Square. The library provides a powerful framework for authenticating and interacting with APIs and sending network requests with OkHttp. See this guide to understand how OkHttp works.
From description:
A call adapter which uses RxJava 2 for creating observables. Adding this class to Retrofit allows you to return an Observable, Flowable, Single, Completable or Maybe from service methods.
interface MyService {
@GET("user/me")
Observable<User> getUser()
}
Without it you cant describe interface as rx type
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With