Networking & Persistence

5 concepts · 10 practice questions

Retrofit and OkHttp

Retrofit turns an annotated interface into HTTP calls and supports suspend functions directly. OkHttp underneath handles connection pooling, caching, timeouts and interceptors. Share one OkHttpClient: each instance has its own pool and threads.

interface Api {
    @GET("users/{id}")
    suspend fun user(@Path("id") id: String): UserDto
}

Also covered

Interceptors
Room
Offline-first
DataStore

Sign in to read the rest and take the 10-question test.

Sign in to continue