Check if Google Play Services is available.
private fun checkPlayServices(): Boolean {
val apiAvailability = GoogleApiAvailability.getInstance()
val resultCode = apiAvailability.isGooglePlayServicesAvailable(this)
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
// Do stuff if Google Play is not available
} else {
// Do stuff if Google Play is available
finish()
}
return false
}
return true
}