com.google.android.gms.location.FusedLocationProviderApi.getLocationAvailability()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(252)

本文整理了Java中com.google.android.gms.location.FusedLocationProviderApi.getLocationAvailability()方法的一些代码示例,展示了FusedLocationProviderApi.getLocationAvailability()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FusedLocationProviderApi.getLocationAvailability()方法的具体详情如下:
包路径:com.google.android.gms.location.FusedLocationProviderApi
类名称:FusedLocationProviderApi
方法名:getLocationAvailability

FusedLocationProviderApi.getLocationAvailability介绍

暂无

代码示例

代码示例来源:origin: yayaa/LocationManager

@SuppressWarnings("ResourceType")
boolean getLocationAvailability() {
  LocationAvailability locationAvailability =
     LocationServices.FusedLocationApi.getLocationAvailability(googleApiClient);
  return locationAvailability != null && locationAvailability.isLocationAvailable();
}

代码示例来源:origin: klaasnotfound/LocationAssistant

private boolean checkLocationAvailability() {
  if (!googleApiClient.isConnected() || !permissionGranted) return false;
  try {
    LocationAvailability la = LocationServices.FusedLocationApi.getLocationAvailability(googleApiClient);
    return (la != null && la.isLocationAvailable());
  } catch (SecurityException e) {
    if (!quiet)
      Log.e(getClass().getSimpleName(), "Error while checking location availability:\n " + e.toString());
    if (listener != null)
      listener.onError(ErrorType.RETRIEVAL, "Could not check location availability:\n" +
          e.getMessage());
    return false;
  }
}

代码示例来源:origin: florent37/RxGps

@Override
  protected void onGoogleApiClientReady(GoogleApiClient apiClient, SingleEmitter<Boolean> emitter) {
    //noinspection MissingPermission
    LocationAvailability locationAvailability = LocationServices.FusedLocationApi.getLocationAvailability(apiClient);

    if (locationAvailability != null) {
      emitter.onSuccess(locationAvailability.isLocationAvailable());
    } else {
      emitter.onSuccess(false);
    }
  }
}

相关文章