Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created August 22, 2018 09:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ssaurel/8e7fe841b823d34fa8d4d1f1de279cd0 to your computer and use it in GitHub Desktop.
Save ssaurel/8e7fe841b823d34fa8d4d1f1de279cd0 to your computer and use it in GitHub Desktop.
Check if Play Services are installed for the GPS Tutorial on the SSaurel's Blog
private boolean checkPlayServices() {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST);
} else {
finish();
}
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment