Google放置的API数量是1个请求的22倍左右

时间:2018-08-02 19:27:56

标签: google-api google-places-api

我最近注意到,我收到的请求大约是我的22倍,因为我应该在Google API控制台上收到该请求,这导致了一些意外费用。以下是我用来获取附近区域医院详细信息的代码。我需要名字和街道地址。

GeoApiContext context = new GeoApiContext.Builder().apiKey("MYAPIKEY")
        .build();

NearbySearchRequest req = PlacesApi.nearbySearchQuery(context,
        new com.google.maps.model.LatLng(Double.valueOf(lat), Double.valueOf(lon)));


PlacesSearchResponse resp = req.keyword("hospital").type(PlaceType.HOSPITAL).radius(42000).await();

if (resp.results != null && resp.results.length > 0) {
    for (PlacesSearchResult r : resp.results) {
        try {
            PlaceDetails placeDetails = PlacesApi.placeDetails(context, r.placeId).await();
            AddressComponent[] address = placeDetails.addressComponents;
        } catch (com.google.maps.errors.NotFoundException nfe) {

        }
    }
}

是什么原因导致此请求注册约22倍的请求?

0 个答案:

没有答案
相关问题