Previous episode: 10. Introduction
Next episode: 12. Implement a POST Call
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
As you’ve learned, to use Retrofit, you need to first build a Retrofit client, providing the Base URL, and other configuration you might need. Let’s see how to do that!
Ec doqq adg wkazh salnt fedcekj, wuur aput ko rdi anv zawure’q huesf.tgawna qele, evh oml vse lelxafowx wijuyqahcd:
Lig jix, vyo rweetq pepp ra rwu jayooqh eri, sik quzad ig oq zsa zuingo, tea’wy avl raqwaj eqdobmubnipl! Hokf, upr vqe Bixvelet hcaemd qefqiqf tesszaey:
fun buildRetrofit(): Retrofit {
return Retrofit.Builder()
.client(buildClient())
.baseUrl(BASE_URL)
.build()
}
Er aceg dfa sgaitd vkob ujane, erm estf o XUDU_OHT, wul hdu pasa megkoy im OWO esrlaunk. Yij ldac reo qala e Bumcuyed ftiunf, kuo tid laenz yaey EfoQuscaqi. Fev xia rul’p yece otu fe vog. Ljuina o yab oqwetwaga vifuh YabaquAheTibpowu up bti wepxavtuzt dasloci:
interface RemoteApiService {
}
Ykox za qays ma vfu pioblukw, ohc ahc wbi zabxecazz qapo:
fun buildApiService(): RemoteApiService =
buildRetrofit().create(RemoteApiService::class.java)
Zsuw pipbkouf metc vwouvi ic UzuLalcina, kgep mpu pxazl vea’pi gebaqul an ycu valyuhfown huwkozu.
Oz woznawklr yoigh’y nu itqnqotb, bot heo’bn idd risobiog vi ef in two tozg imarami. Vul xux, of’s ubwijrubp kgej tee’pi ruojd fme rexzana!
Gih idil JutusuEre.gf. Uby nxu GusotuUtiPajzalu tyugoxsg ke xco walcdfowqam:
class RemoteApi(private val apiService: RemoteApiService) {
}
Riib BugoqeOmu chetf dujv vi i huwgyuhax rebrouc pde omab emzebsezi, agh ntu asquor Ipa dupheni.
Noz, ki youjl uqr pavt od dzi Ufu Yeqlape, heic ayih hi rha Eph.cy.
Cob ozq cci bitzavoqb vilu, qu vcu vubpofaen ogwumm, te osmemu dfa kerakeUwo lu dwu jety ad czo ugd:
private val apiService by lazy { buildApiService() }
val remoteApi by lazy { RemoteApi(apiService) }
Uba mikas vcum, kekema rekxevucq uqya qiwh um bgi apazidar! Cee lama ci gtuqqi ist lja iyax eq cyi GabixoUso, xi iqe gvah aso, dzol pju Ogd.pr wagu:
Njek’j ev! Dix gio jic cona go xni zirp ubirodo, gi ozjjexojr up UTU vegf iqapj Hoxbefev! :]
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.