Проверка за съществуване на Google Play Services – Android


Проверка дали Google Play Services е достъпно.
Лесно може да проверите дали може да извикате карта, GPS локация или някаква друга функционалност от Google Play Services

/**
 * Check if Google Play services is available before making a request.
 *
 * @return true if Google Play services is available, otherwise false
 */
protected boolean googleServicesExist() {

    // Check that Google Play services is available
    int resultCode =
            GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

    // If Google Play services is available
    if (ConnectionResult.SUCCESS == resultCode) {
        return true;
    // Google Play services was not available for some reason
    } else {
        return false;
    }
}
  1. Няма коментари.
(will not be published)