Last active
August 6, 2018 13:03
-
-
Save vicky7230/795b4c8e53121ed34a4e011106e6f022 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(); | |
if (BuildConfig.DEBUG) { | |
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); | |
} else { | |
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.NONE); | |
} | |
OkHttpClient okHttpClient = new OkHttpClient.Builder() | |
.readTimeout(1000, TimeUnit.SECONDS) | |
.addInterceptor(httpLoggingInterceptor) | |
.build(); | |
Retrofit retrofit = new Retrofit.Builder() | |
.baseUrl(Config.BASE_URL) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) | |
.client(okHttpClient) | |
.build(); | |
CommonApiService commonApiService = retrofit.create(CommonApiService.class); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment