Encryption can be one of the reasons, and, to be exact, it's easy to touch with the options in the okhttp client.
Below is the code I used, which monitors all activities in which the api communicates through the network interceptor to the okhttp client, and uses a setting that stops when the api call is prolonged due to the connection timeout.
These features and encryption can't be configured only on okhttp clients. But it's true that it's comfortable because I used it often.
public static Retrofit createRetrofit() {
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.addNetworkInterceptor(new StethoInterceptor())
.connectTimeout(CONNECT_TIMEOUT_SEC, TimeUnit.SECONDS)
.build();
return new Retrofit.Builder()
.baseUrl(Constant.API.BASE)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
© 2024 OneMinuteCode. All rights reserved.