Posts

Showing posts with the label integration

Retrofit Integration in Android - Kotlin

Image
Retrofit is a Networking library, which is faster to use and easier to develop. Let’s see how to integrate Retrofit in Android with Kotlin. If you'd like to integrate RxJava as well, you can check here . 1. Configure: Include the following in app-level build.gradle. build.gradle compile "com.squareup.retrofit2:retrofit:2.3.0" compile "com.squareup.retrofit2:converter-gson:2.3.0" Include internet permission in Manifest file. AndroidManifest.xml <uses-permission android:name="android.permission.INTERNET" /> 2. Preparing Helper classes: ApiInterface.kt interface ApiInterface {    @POST("get_users_detail") // Your url    fun getUser(@Body requestBody: RequestBody): Call<UserResponse> } Model classes:                      Response from Retrofit will be stored in POJO classes directly. UserResponse.kt data class UserResponse(var httpCode: String, var user: Array