Last active
April 25, 2020 23:06
-
-
Save pedrovarela86/e341190621dc28745dbe677cb7cb851b to your computer and use it in GitHub Desktop.
Función para verificar la disponibiliadad de Google Play Services
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
private var errorDialog: Dialog? = null | |
private fun checkGooglePlayServices(): Boolean { | |
val googleApiAvailability: GoogleApiAvailability = GoogleApiAvailability.getInstance() | |
val resultCode: Int = googleApiAvailability.isGooglePlayServicesAvailable(this) | |
if (resultCode != ConnectionResult.SUCCESS) { | |
if (googleApiAvailability.isUserResolvableError(resultCode)) { | |
if (errorDialog == null) { | |
errorDialog = googleApiAvailability.getErrorDialog(this, resultCode, 2404) | |
errorDialog?.setCancelable(false) | |
} | |
if (errorDialog?.isShowing == false) errorDialog?.show() | |
} | |
} | |
return resultCode == ConnectionResult.SUCCESS | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment