I have android application that was working fine for most of devices Recently some hackers tried to make DDOS attack on our servers that force us to add some security and so
Use this in your code before making any network call
/**
* Initialize SSL
* @param mContext
*/
public static void initializeSSLContext(Context mContext){
try {
SSLContext.getInstance("TLSv1.2");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
try {
ProviderInstaller.installIfNeeded(mContext.getApplicationContext());
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
}
I had the same problem and this piece of code solved my problem. FYI: I was using retrofit library for making network calls
You need to include below line in build.gradle
implementation 'com.google.android.gms:play-services-safetynet:17.0.0
Thanks @Houman for the above input