FindAutocompletePredictionsRequest

public abstract class FindAutocompletePredictionsRequest extends Object
implements Request

Nested Class Summary

class FindAutocompletePredictionsRequest.Builder Builder for FindAutocompletePredictionsRequest

Public Constructor Summary

Public Method Summary

static FindAutocompletePredictionsRequest.Builder
abstract CancellationToken
getCancellationToken()
Returns the CancellationToken used by PlacesClient to cancel any queued requests.
abstract List<String>
getCountries()
Returns a list of countries to which results will be restricted.
String
abstract Integer
getInputOffset()
Returns the prediction term offset.
abstract LocationBias
getLocationBias()
Returns the location bias applied for autocomplete predictions.
abstract LocationRestriction
getLocationRestriction()
Returns the location restriction applied for autocomplete predictions.
abstract LatLng
getOrigin()
Returns the location where AutocompletePrediction.getDistanceMeters() is calculated from.
abstract String
getQuery()
Returns the user query string used to generate autocomplete predictions.
abstract String
getRegionCode()
The unicode country/region code (CLDR) of the location where the request is coming from.
abstract AutocompleteSessionToken
getSessionToken()
Returns the AutocompleteSessionToken for this request.
abstract TypeFilter
abstract List<String>
getTypesFilter()
Returns the filter used to restrict the type(s) of the results returned.
static FindAutocompletePredictionsRequest

Inherited Method Summary

Public Constructors

public FindAutocompletePredictionsRequest ()

Public Methods

public abstract CancellationToken getCancellationToken ()

Returns the CancellationToken used by PlacesClient to cancel any queued requests.

public abstract List<String> getCountries ()

Returns a list of countries to which results will be restricted. See FindAutocompletePredictionsRequest.Builder.setCountries(List) for details.

public String getCountry ()

This method is deprecated.
Use FindAutocompletePredictionsRequest.Builder.setCountries(List) & getCountries() instead.

Returns the country to which results will be restricted.

This should be a ISO 3166-1 Alpha-2 country code (case insensitive). If null or empty, country restrictions will not be applied.

Throws
UnsupportedOperationException if multiple countries were set on this request.

public abstract Integer getInputOffset ()

Returns the prediction term offset. A zero-based Unicode character offset of the query selecting the term in that should be used for autocompletions. The specific offset within a term does not matter. For example, given a query of "indian restaurant", any offset from 0 to 6 will select "indian" as the term.

The selected term may appear as a prefix in the predicted text while the remaining terms will appear as exact matches in the predicted text.

If null, defaults to the length of the query, meaning the last term in the query will be used.

The input offset field is only supported by Places API (New). Please enable your API key for the Places API (New) in the Google Cloud Console to use input offset. If you do not enable your API key for the Places API (New), the input offset will not affect the results.

public abstract LocationBias getLocationBias ()

Returns the location bias applied for autocomplete predictions. See FindAutocompletePredictionsRequest.Builder.setLocationBias(LocationBias) for details.

public abstract LocationRestriction getLocationRestriction ()

Returns the location restriction applied for autocomplete predictions. See FindAutocompletePredictionsRequest.Builder.setLocationRestriction(LocationRestriction) for details.

public abstract LatLng getOrigin ()

Returns the location where AutocompletePrediction.getDistanceMeters() is calculated from. If null, no distances will be included in the response.

public abstract String getQuery ()

Returns the user query string used to generate autocomplete predictions. If null or empty, no predictions will be included in the response.

public abstract String getRegionCode ()

The unicode country/region code (CLDR) of the location where the request is coming from.

Specified as a CLDR two-character region code. This affects address formatting, result ranking, and may influence what results are returned.

This does not restrict results to the specified region. To restrict results to a region use countries or LocationRestriction.

The region code field is only supported by Places API (New). Please enable your API key for the Places API (New) in the Google Cloud Console to use region code. If you do not enable your API key for the Places API (New), the region code will not affect the results.

public abstract AutocompleteSessionToken getSessionToken ()

Returns the AutocompleteSessionToken for this request.

public abstract TypeFilter getTypeFilter ()

This method is deprecated.
Use FindAutocompletePredictionsRequest.Builder.setTypesFilter(List) and getTypesFilter() instead.

Returns the filter used to restrict the type of the results returned.

public abstract List<String> getTypesFilter ()

Returns the filter used to restrict the type(s) of the results returned.

A comprehensive list of the supported types can be found in PlaceTypes.

public static FindAutocompletePredictionsRequest newInstance (String query)

Parameters
query The string used to generate autocomplete predictions. If null or empty, no predictions will be included in the response.