-
-
Save patrickhammond/0b13ec35160af758d98c to your computer and use it in GitHub Desktop.
package com.mycompany.myapp.app; | |
import android.app.Application; | |
import android.content.Intent; | |
import com.google.android.gms.common.GooglePlayServicesUtil; | |
import com.google.android.gms.security.ProviderInstaller; | |
import com.google.android.gms.security.ProviderInstaller.ProviderInstallListener; | |
public class MainApplication extends Application { | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
upgradeSecurityProvider(); | |
} | |
private void upgradeSecurityProvider() { | |
ProviderInstaller.installIfNeededAsync(this, new ProviderInstallListener() { | |
@Override | |
public void onProviderInstalled() { | |
} | |
@Override | |
public void onProviderInstallFailed(int errorCode, Intent recoveryIntent) { | |
GooglePlayServicesUtil.showErrorNotification(errorCode, MainApplication.this); | |
} | |
}); | |
} | |
} |
I used this one
implementation 'com.google.android.gms:play-services-safetynet:15.0.1'
and everything worked as expected.
GooglePlayServicesUtil.showErrorNotification(...)
is now deprecated; should be replaced with
GoogleApiAvailability.getInstance().showErrorNotification(...)
.
@noamtamim But it gives this error: no suitable method found for showErrorNotification(int,MainActivity)
GoogleApiAvailability.getInstance().showErrorNotification(errorCode, MainActivity.this); when you update it like you mentioned
@noamtamim But it gives this error: no suitable method found for showErrorNotification(int,MainActivity)
GoogleApiAvailability.getInstance().showErrorNotification(errorCode, MainActivity.this); when you update it like you mentioned
You should use it like this :
@Override
public void onProviderInstallFailed(int i, Intent intent) {
GoogleApiAvailability.getInstance().showErrorNotification(MainApplication.this, i);
}
Greetings
This has solved an issue for me, thanks. I have a doubt. I'm using this library:
compile 'com.google.android.gms:play-services-base:11.0.0'
Is that the correct library?