GeoDataClient

public class GeoDataClient extends GoogleApi<PlacesOptions>

This class is deprecated.
The Google Play Services Places SDK is deprecated. A new SDK is available. See the client migration guide for more information.

Main entry point for the Google Places Geo Data API.

The Geo Data API provides access to Google's database of local place and business information. A place, generally, is defined as a particular physical space that has a name. The Geo Data API provides access to getting information about places by place ID, autocompleting a user's search query by name or address, and adding new places to Google's Places database. Most API methods involve a network round-trip to a Google server.

Some methods are subject to a quota limit, as mentioned in the description of the methods concerned. See the developer's guide for more information on quota and usage limits.

Nested Class Summary

@interface GeoDataClient.BoundsMode Bounds restriction to be applied to Autocomplete predictions. 

Inherited Field Summary

Public Method Summary

Task<PlaceBufferResponse>
addPlace(AddPlaceRequest addPlaceRequest)
This method is deprecated. The addPlace() method is deprecated as of June 30, 2017. This feature will be turned down on June 30, 2018, and will no longer be available after that date.
Task<AutocompletePredictionBufferResponse>
getAutocompletePredictions(String query, LatLngBounds bounds, AutocompleteFilter filter)
Returns autocomplete predictions for a query based on the names and addresses of places.
Task<AutocompletePredictionBufferResponse>
getAutocompletePredictions(String query, LatLngBounds bounds, int boundsMode, AutocompleteFilter filter)
Returns autocomplete predictions for a query based on the names and addresses of places.
Task<PlacePhotoResponse>
getPhoto(PlacePhotoMetadata photoMetadata)
Retrieves the image data for this photo at its maximum size.
Task<PlaceBufferResponse>
getPlaceById(String... placeIds)
Returns Place objects for each of the given place IDs.
Task<PlacePhotoMetadataResponse>
getPlacePhotos(String placeId)
Returns the metadata for up to 10 photos associated with a place.
Task<PlacePhotoResponse>
getScaledPhoto(PlacePhotoMetadata photoMetadata, int width, int height)
Retrieves the image data for this photo, scaled to fit the given dimensions.

Inherited Method Summary

Public Methods

public Task<PlaceBufferResponse> addPlace (AddPlaceRequest addPlaceRequest)

This method is deprecated.
The addPlace() method is deprecated as of June 30, 2017. This feature will be turned down on June 30, 2018, and will no longer be available after that date.

Adds a place to Google's Places database.

By adding a place, you can supplement the data in the Places database with data from your application. Added places are visible to your app immediately and are added to a moderation queue for possible inclusion in Google's Places database. For more information, see the developer's guide.

This method performs a network lookup.

Be sure to call release() when finished with the result.

Parameters
addPlaceRequest A request specifying the details of the place to be added.
Returns
  • A buffer containing a Place object representing the added place.

public Task<AutocompletePredictionBufferResponse> getAutocompletePredictions (String query, LatLngBounds bounds, AutocompleteFilter filter)

Returns autocomplete predictions for a query based on the names and addresses of places. For more information, see the developer's guide.

This method performs a network lookup.

Access to this method is subject to quota restrictions. See Usage Limits for more details.

Be sure to call release() when finished with the result.

Parameters
query The query string for which the autocomplete predictions are to be fetched. If null or empty, no predictions will be returned.
bounds A geographic bounds. If present, returned predictions will be biased towards places in this area.
filter A filter to use for restricting the returned predictions. If null, a filter with no constraints will be used.
Returns
  • A buffer containing a list of predictions for the query.

public Task<AutocompletePredictionBufferResponse> getAutocompletePredictions (String query, LatLngBounds bounds, int boundsMode, AutocompleteFilter filter)

Returns autocomplete predictions for a query based on the names and addresses of places. For more information, see the developer's guide.

This method performs a network lookup.

Access to this method is subject to quota restrictions. See Usage Limits for more details.

Be sure to call release() when finished with the result.

Parameters
query The query string for which the autocomplete predictions are to be fetched. If null or empty, no predictions will be returned.
bounds A geographic bounds. If present, returned predictions will be influenced towards places in this area as per the boundsMode parameter.
boundsMode How to treat the bounds parameter. When set to STRICT predictions are contained by the supplied bounds. If set to BIAS predictions are biased towards the supplied bounds. If bounds is null then this parameter has no effect.
filter A filter to use for restricting the returned predictions. If null, a filter with no constraints will be used.
Returns
  • A buffer containing a list of predictions for the query.

public Task<PlacePhotoResponse> getPhoto (PlacePhotoMetadata photoMetadata)

Retrieves the image data for this photo at its maximum size.

The photos service may cache the image data. If the requested photo does not exist in the cache then a network lookup will be performed.

Access to this method is subject to quota restrictions. See Usage Limits for more details.

Parameters
photoMetadata The PlacePhotoMetadata for which to load the photo bitmap.
Returns

public Task<PlaceBufferResponse> getPlaceById (String... placeIds)

Returns Place objects for each of the given place IDs.

This method might return fewer places than requested if some of the given ids could not be resolved.

The maximum number of place IDs that will be returned is 20. If more than 20 places are requested, some of them may not be returned.

The Geo Data API may cache recently accessed places. If any of the requested places are not cached then this method will perform a network lookup.

Access to this method is subject to quota restrictions. See Usage Limits for more details.

Be sure to call release() when finished with the result.

Parameters
placeIds The place IDs to look up. At least one ID should be provided.
Returns
  • A buffer containing the requested places.

public Task<PlacePhotoMetadataResponse> getPlacePhotos (String placeId)

Returns the metadata for up to 10 photos associated with a place.

Photos are sourced from a variety of locations, including business owners and photos contributed by Google+ users. In most cases, these photos can be used without attribution, or will have the required attribution included as a part of the image. However, you must call getAttributions() to retrieve any additional attributions required, and display those attributions in your application wherever you display the image. A maximum of 10 photos is returned. For more information, see the developer's guide.

Multiple calls of this method will probably return the same photos each time. However, this is not guaranteed because the underlying data may have changed.

This method performs a network lookup.

Be sure to call release() when finished with the result.

Parameters
placeId The Place ID of the place
Returns
  • a buffer containing metadata about the photos available for the requested place.

public Task<PlacePhotoResponse> getScaledPhoto (PlacePhotoMetadata photoMetadata, int width, int height)

Retrieves the image data for this photo, scaled to fit the given dimensions.

The image will be scaled to match the smaller of the given dimensions whilst maintaining the original aspect ratio. This scaling is performed server-side.

The photos service may cache the image data. If the requested photo does not exist in the cache then a network lookup will be performed.

Access to this method is subject to quota restrictions. See Usage Limits for more details.

Parameters
photoMetadata The PlacePhotoMetadata for which to load the photo bitmap.
width The desired maximum width in pixels.
height The desired maximum height in pixels.
Returns
Throws
IllegalArgumentException If either of the given width or height values are less than or equal to 0.