diff --git a/app/build.gradle b/app/build.gradle index 645b1c5..bc49015 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,6 +26,7 @@ dependencies { implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.squareup.retrofit2:retrofit:2.4.0' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' + implementation 'com.google.android.gms:play-services-auth:16.0.1' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8ba2cdc..a54b321 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,6 +8,7 @@ android:icon="@drawable/launcher" android:label="@string/app_name" android:supportsRtl="true" + android:name=".MyApplication" android:theme="@style/AppTheme"> diff --git a/app/src/main/java/com/spitslide/ukpetitions/MyApplication.java b/app/src/main/java/com/spitslide/ukpetitions/MyApplication.java new file mode 100644 index 0000000..05c5012 --- /dev/null +++ b/app/src/main/java/com/spitslide/ukpetitions/MyApplication.java @@ -0,0 +1,33 @@ +package com.spitslide.ukpetitions; + + +import android.app.Application; + +import com.google.android.gms.common.GooglePlayServicesNotAvailableException; +import com.google.android.gms.common.GooglePlayServicesRepairableException; +import com.google.android.gms.security.ProviderInstaller; + +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; + +import javax.net.ssl.SSLContext; + +public class MyApplication extends Application { + @Override + public void onCreate() { + super.onCreate(); + + // needed for pre-Lollipop devices + // https://stackoverflow.com/a/51285550/9702500 + try { + ProviderInstaller.installIfNeeded(getApplicationContext()); + SSLContext sslContext; + sslContext = SSLContext.getInstance("TLSv1.2"); + sslContext.init(null, null, null); + sslContext.createSSLEngine(); + } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException + | NoSuchAlgorithmException | KeyManagementException e) { + e.printStackTrace(); + } + } +}