Skip to content

Instantly share code, notes, and snippets.

@4brunu
Created April 15, 2021 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4brunu/477baad29c1e626b31baab53a16e4fa9 to your computer and use it in GitHub Desktop.
Save 4brunu/477baad29c1e626b31baab53a16e4fa9 to your computer and use it in GitHub Desktop.
google-play-services-verification.kt
checkGooglePlayServices = { activity ->
val apiAvailability = GoogleApiAvailability.getInstance()
val resultCode = apiAvailability.isGooglePlayServicesAvailable(this)
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(
activity,
resultCode,
PLAY_SERVICES_RESOLUTION_REQUEST
)
.show()
} else {
AlertDialog.Builder(activity)
.setMessage(R.string.teleconsultationlite_google_play_services_not_available)
.setCancelable(false)
.setNeutralButton(R.string.teleconsultationlite_ok) { _, _ ->
}
.show()
}
return@setup false
}
return@setup true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment