Created
April 15, 2021 09:09
-
-
Save 4brunu/477baad29c1e626b31baab53a16e4fa9 to your computer and use it in GitHub Desktop.
google-play-services-verification.kt
This file contains 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
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