PlacesClient

public interface PlacesClient

Client that exposes the Places API methods. To get a PlacesClient, use Places.createClient(android.content.Context).

Public Method Summary

abstract Task<FetchPhotoResponse>
fetchPhoto(FetchPhotoRequest request)
Fetches a photo.
abstract Task<FetchPlaceResponse>
fetchPlace(FetchPlaceRequest request)
Fetches the details of a place.
abstract Task<FindAutocompletePredictionsResponse>
findAutocompletePredictions(FindAutocompletePredictionsRequest request)
Fetches autocomplete predictions.
abstract Task<FindCurrentPlaceResponse>
findCurrentPlace(FindCurrentPlaceRequest request)
Fetches the approximate current location of the user's device.
abstract Task<IsOpenResponse>
isOpen(IsOpenRequest request)
Returns whether or not a place is open, fetching any place info using fetchPlace(FetchPlaceRequest) (if necessary).
abstract Task<SearchByTextResponse>
searchByText(SearchByTextRequest request)
Search for place(s) of interest using a text query.

Public Methods

public abstract Task<FetchPhotoResponse> fetchPhoto (FetchPhotoRequest request)

Fetches a photo.

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.

Parameters
request The request specifying the photo to request.
Returns
  • response containing the photo requested or an ApiException if an error occurred.

public abstract Task<FetchPlaceResponse> fetchPlace (FetchPlaceRequest request)

Fetches the details of a place.

Parameters
request The request specifying the place of interest.
Returns
  • Response containing the place of interest or an ApiException if an error occurred.

public abstract Task<FindAutocompletePredictionsResponse> findAutocompletePredictions (FindAutocompletePredictionsRequest request)

Fetches autocomplete predictions.

Parameters
request The request specifying details of the autocomplete query.
Returns
  • Response containing the list of prediction objects or an ApiException if an error occurred.

public abstract Task<FindCurrentPlaceResponse> findCurrentPlace (FindCurrentPlaceRequest request)

Fetches the approximate current location of the user's device.

The device must have Location Services enabled, and the app must have the following permissions granted.

Calling this method without granting this permission in the manifest will result in a SecurityException being thrown.

This API assumes Fused Location Provider is available on the device, in order to retrieve it's current location.

Parameters
request the request specifying filtering details.
Returns
  • response containing the user's current place candidates or an ApiException if an error occurred.

public abstract Task<IsOpenResponse> isOpen (IsOpenRequest request)

Returns whether or not a place is open, fetching any place info using fetchPlace(FetchPlaceRequest) (if necessary).

If providing a Place object, Place.Field.ID is required, else an IllegalArgumentException will be thrown. If the following fields are not provided, a request will be made to fetch the info:

Parameters
request The request specifying the place information and time for if a place is open.
Returns
  • Response on whether the place of interest is open or an ApiException if an error occurred.

public abstract Task<SearchByTextResponse> searchByText (SearchByTextRequest request)

Search for place(s) of interest using a text query.

SearchByText is only supported by Places API (New). Please enable your API key for the Places API (New) in the Google Cloud Console to access this service.

Parameters
request The request specifying the parameters for the search.
Returns
  • Response containing the place(s) of interest or an ApiException if an error occurred.