0

Android lower version devices (4.*) gives SSL error. Works perfectly on high versions of Android

I use a class that processes JSON requests, But in Android 4.4, no information about Json is loaded


    public static ApiInterface createAPI() {

        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        builder.connectTimeout(30, TimeUnit.SECONDS);
        builder.writeTimeout(30, TimeUnit.SECONDS);
        builder.readTimeout(30, TimeUnit.SECONDS);
        builder.cache(null);
        OkHttpClient okHttpClient = builder.build();
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Constant.'https://example.com/alljson')
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .client(okHttpClient)
                .build();

        return retrofit.create(ApiInterface.class);
    }
}

Please simply explain what I should do to make Jason load from HTTPS Addresses on all devices Thanks all

AmirHadi
  • 53
  • 8
  • This might help you https://stackoverflow.com/questions/28943660/how-to-enable-tls-1-2-support-in-an-android-application-running-on-android-4-1/55365051 – Amin Apr 19 '21 at 20:53
  • Thanks, but in this particular class I want to fix the problem because the method of use is different in detail – AmirHadi Apr 19 '21 at 20:58

0 Answers0