فهرست منبع

fix downloading mods on Android 4.4

fixes TLS issue
Andrey Filipenkov 2 سال پیش
والد
کامیت
c62d945b2d
2فایلهای تغییر یافته به همراه15 افزوده شده و 0 حذف شده
  1. 2 0
      android/vcmi-app/build.gradle
  2. 13 0
      android/vcmi-app/src/main/java/eu/vcmi/vcmi/ActivityMods.java

+ 2 - 0
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'
 }

+ 13 - 0
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