Created
March 8, 2015 02:30
-
-
Save patrickhammond/0b13ec35160af758d98c to your computer and use it in GitHub Desktop.
Sample for how to use the Google Play Services dynamic security provider to keep the SSL library that the app will use to up date.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
}); | |
} | |
} |
@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);
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GooglePlayServicesUtil.showErrorNotification(...)
is now deprecated; should be replaced withGoogleApiAvailability.getInstance().showErrorNotification(...)
.