3

I am required to make all API calls to a server using TLS 1.2. I am using volley (v1.1.1) with minSDKversion 21. How is it possible to ensure that all calls are done with TLS 1.2?

Avital
  • 549
  • 5
  • 15
Arun Baby
  • 67
  • 6

1 Answers1

0

have you tried this?

Add play-services-safetynet library in android build.gradle:

implementation 'com.google.android.gms:play-services-safetynet:+'

and add this code to your MainApplication.java:

  @Override
  public void onCreate() {
    super.onCreate();
    upgradeSecurityProvider();
    SoLoader.init(this, /* native exopackage */ false);
  }

  private void upgradeSecurityProvider() {
    ProviderInstaller.installIfNeededAsync(this, new ProviderInstallListener() {
      @Override
      public void onProviderInstalled() {

      }

      @Override
      public void onProviderInstallFailed(int errorCode, Intent recoveryIntent) {
//        GooglePlayServicesUtil.showErrorNotification(errorCode, MainApplication.this);
        GoogleApiAvailability.getInstance().showErrorNotification(MainApplication.this, errorCode);
      }
    });
  }

Reference : https://stackoverflow.com/a/55365051/5320349

sashoalm
  • 75,001
  • 122
  • 434
  • 781
  • tnx, I will try it now. But to be sure - should I use Volley request inside onProviderInstalled()? or just paste the code below in mainActivity () and it will "make all the app use tls"? – Avital Nov 07 '21 at 12:05
  • and what is SoLoader.init? what should I write inistead of /*native exopackage*/? – Avital Nov 08 '21 at 08:52