FindAutocompletePredictionsRequest

public abstract class FindAutocompletePredictionsRequest implements Request


Request used by findAutocompletePredictions.

Summary

Nested types

Builder for FindAutocompletePredictionsRequest.

Public constructors

Public methods

static FindAutocompletePredictionsRequest.Builder

Returns a Builder.

abstract @Nullable CancellationToken

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

abstract List<String>

Returns a list of countries to which results will be restricted.

@Nullable String

This method is deprecated.

Use setCountries&getCountries instead.

abstract @Nullable Integer

Returns the prediction term offset.

abstract @Nullable LocationBias

Returns the location bias applied for autocomplete predictions.

abstract @Nullable LocationRestriction

Returns the location restriction applied for autocomplete predictions.

abstract @Nullable LatLng

Returns the location where getDistanceMeters is calculated from.

abstract @Nullable String

Returns the user query string used to generate autocomplete predictions.

abstract @Nullable String

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

abstract @Nullable AutocompleteSessionToken

Returns the AutocompleteSessionToken for this request.

abstract @Nullable TypeFilter

This method is deprecated.

Use setTypesFilter and getTypesFilter instead.

abstract List<String>

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

static FindAutocompletePredictionsRequest

Returns a FindAutocompletePredictionsRequest.

Public constructors

FindAutocompletePredictionsRequest

public FindAutocompletePredictionsRequest()

Public methods

builder

public static FindAutocompletePredictionsRequest.Builder builder()

Returns a Builder.

getCancellationToken

public abstract @Nullable CancellationToken getCancellationToken()

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

getCountries

public abstract List<StringgetCountries()

Returns a list of countries to which results will be restricted. See setCountries for details.

getCountry

public @Nullable String getCountry()

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
java.lang.UnsupportedOperationException

if multiple countries were set on this request.

getInputOffset

public abstract @Nullable 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.

getLocationBias

public abstract @Nullable LocationBias getLocationBias()

Returns the location bias applied for autocomplete predictions. See setLocationBias for details.

getLocationRestriction

public abstract @Nullable LocationRestriction getLocationRestriction()

Returns the location restriction applied for autocomplete predictions. See setLocationRestriction for details.

getOrigin

public abstract @Nullable LatLng getOrigin()

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

getQuery

public abstract @Nullable String getQuery()

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

getRegionCode

public abstract @Nullable 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.

getSessionToken

public abstract @Nullable AutocompleteSessionToken getSessionToken()

Returns the AutocompleteSessionToken for this request.

getTypeFilter

public abstract @Nullable TypeFilter getTypeFilter()

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

getTypesFilter

public abstract List<StringgetTypesFilter()

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

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

newInstance

public static FindAutocompletePredictionsRequest newInstance(@Nullable String query)

Returns a FindAutocompletePredictionsRequest.

Parameters
@Nullable String query

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