From c62d945b2d6e698becc16a02dc3cdd81238639c1 Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Sat, 4 Mar 2023 14:35:56 +0300 Subject: [PATCH] fix downloading mods on Android 4.4 fixes TLS issue --- android/vcmi-app/build.gradle | 2 ++ .../src/main/java/eu/vcmi/vcmi/ActivityMods.java | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/android/vcmi-app/build.gradle b/android/vcmi-app/build.gradle index c0e41bd47..4933f7b8f 100644 --- a/android/vcmi-app/build.gradle +++ b/android/vcmi-app/build.gradle @@ -157,4 +157,6 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'com.google.android.gms:play-services-base:18.2.0' + implementation 'com.google.android.gms:play-services-basement:18.1.0' } diff --git a/android/vcmi-app/src/main/java/eu/vcmi/vcmi/ActivityMods.java b/android/vcmi-app/src/main/java/eu/vcmi/vcmi/ActivityMods.java index 8d9934ec4..7b010b903 100644 --- a/android/vcmi-app/src/main/java/eu/vcmi/vcmi/ActivityMods.java +++ b/android/vcmi-app/src/main/java/eu/vcmi/vcmi/ActivityMods.java @@ -19,6 +19,11 @@ import android.view.MenuItem; import android.view.View; import android.widget.TextView; +import com.google.android.gms.common.GooglePlayServicesNotAvailableException; +import com.google.android.gms.common.GooglePlayServicesRepairableException; +import com.google.android.gms.common.GooglePlayServicesUtil; +import com.google.android.gms.security.ProviderInstaller; + import org.json.JSONException; import org.json.JSONObject; @@ -78,6 +83,14 @@ public class ActivityMods extends ActivityWithToolbar mRecycler.setAdapter(mModsAdapter); new AsyncLoadLocalMods().execute((Void) null); + + try { + ProviderInstaller.installIfNeeded(this); + } catch (GooglePlayServicesRepairableException e) { + GooglePlayServicesUtil.getErrorDialog(e.getConnectionStatusCode(), this, 0); + } catch (GooglePlayServicesNotAvailableException e) { + Log.e("SecurityException", "Google Play Services not available."); + } } private void loadLocalModData() throws IOException, JSONException