Mobile Foundation with Upgraded Version Of OkHttp

Mobile Foundation (MF) Android SDK uses OkHttp third party library to establish the communication between MF client and server. Starting API level 28 (Android 9), Android started restricting the non-SDK interfaces used in the app. In the newer releases of Android OS, few of the methods from Okhttp v3.4.1 bundled in MF Android SDK have been black listed and below warnings are seen on Google Play Store console.

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setHostname(Ljava/lang/String;)V

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setUseSessionTickets(Z)V

To address warnings from Play Store, we have upgraded OkHttp used in MF SDK to v3.14.9. Upgraded version of OkHttp changes have been delivered in the below MF Android SDK levels.

Native Android

ibmmobilefirstplatformfoundation@8.0.2021061706

Cordova Android

cordova-plugin-mfp@8.0.2021062103

#Pre-requisites

minSdkVersion API level is 21

In our earlier blog we had announced minimum supported API level of Android is API 21 / Android 5.0 / Lollipop. MF SDK with upgraded OkHttp changes will enforce minSdkVersion API level to be 21 in the app.

Upgraded OkHttp changes require Java 1.8

OkHttp v3.14.9 require Java 1.8 to be enabled in the app, in Cordova apps Java 1.8 is enabled by default, for Native android apps add the below compileOptions in apps build.gradle file of the app.

android {
    ---
     ---
     compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
      }
       ---
        ---
   }
Last modified on July 06, 2021