google service check in android
private fun checkGooglePlayServices(): Boolean {
// 1
val status = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this)
// 2
return if (status != ConnectionResult.SUCCESS) {
Log.e(TAG, "Error")
// ask user to update google play services and manage the error.
false
} else {
// 3
Log.i(TAG, "Google play services updated")
true
}
}