Skip to content

dvt1405/ApiAndroid

Repository files navigation

ApiAndroid

This library help you check your api history which you use in your app

Download

Download the lastest version via maven and gradle

Newest vertion = 1.1.15

In your build.gradle app module

def newestVerion = '1.1.15'
dependencies {
    implementation "com.kt.api:$newestVerion"
}

Usage

Demo when use retrofit

Step 1

Add interceptor to your OkHttpClient

Kotlin
val interceptor = CustomInterceptor()
interceptor.level = CustomInterceptor.Level.BODY
val client = OkHttpClient.Builder()
            .addInterceptor(interceptor)
            .build()
Retrofit.Builder()
            .baseUrl(Constants.DEVICE_BASE_URL[env])
            .client(client)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .build()
            .create(API::class.java)
            
Java
CustomInterceptor interceptor = new CustomInterceptor();
interceptor.setLevel(CustomInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder()
            .addInterceptor(interceptor)
            .build();
// create retrofit interface
API retrofit = new Retrofit.Builder()
            .baseUrl(Constants.DEVICE_BASE_URL[env])
            .client(client)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .build()
            .create(API::class.java);
            

Step 2: Extend BaseActivity

Kotlin
class WelcomeActivity : BaseActivity() {
...
}
Java
public class WelcomeActivity extends BaseActivity {
...
}

Step 3: Install your app to device and shake your app to show dialog api history:

List api

Untitled-1

Info

Untitled-2

Request

Untitled-3

Response

Untitled-4

About

Check ap, paintviewi for android dev(branch: master/paintview)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages