-
-
Save iosandroiddev/38b28d57d676a00921ac1bf379c98964 to your computer and use it in GitHub Desktop.
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
object GoogleApiAvailabilityHelper { | |
private const val REQUEST_CODE_GOOGLE_AVAILABILITY = 999 | |
fun checkAvailability(activity: Activity): Boolean { | |
val googleApiAvailability = GoogleApiAvailability.getInstance() | |
val statusCode = googleApiAvailability.isGooglePlayServicesAvailable(activity) | |
val isResultSuccess = statusCode == ConnectionResult.SUCCESS | |
if (!isResultSuccess && googleApiAvailability.isUserResolvableError(statusCode)) { | |
googleApiAvailability.showErrorDialogFragment(activity, statusCode, REQUEST_CODE_GOOGLE_AVAILABILITY) | |
return false | |
} | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment