Skip to content

Instantly share code, notes, and snippets.

@kamaubrian
Created October 10, 2018 17:34
Show Gist options
  • Save kamaubrian/256d1e80c4362e80fa523d68c930b45b to your computer and use it in GitHub Desktop.
Save kamaubrian/256d1e80c4362e80fa523d68c930b45b to your computer and use it in GitHub Desktop.

Revisions

  1. @kristopherjohnson kristopherjohnson revised this gist Nov 20, 2013. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions checkGooglePlayServicesAvailable.java
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,10 @@
    /**
    * Check whether Google Play Services are available.
    *
    * If not, then display dialog allowing user to update Google Play Services
    *
    * @return true if available, or false if not
    */
    private boolean checkGooglePlayServicesAvailable()
    {
    final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
  2. @kristopherjohnson kristopherjohnson created this gist Nov 19, 2013.
    21 changes: 21 additions & 0 deletions checkGooglePlayServicesAvailable.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    private boolean checkGooglePlayServicesAvailable()
    {
    final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
    if (status == ConnectionResult.SUCCESS)
    {
    return true;
    }

    Log.e(LOGTAG, "Google Play Services not available: " + GooglePlayServicesUtil.getErrorString(status));

    if (GooglePlayServicesUtil.isUserRecoverableError(status))
    {
    final Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(status, this, 1);
    if (errorDialog != null)
    {
    errorDialog.show();
    }
    }

    return false;
    }