FindAutocompletePredictionsRequest.Builder

public abstract class FindAutocompletePredictionsRequest.Builder


Builder for FindAutocompletePredictionsRequest.

Summary

Public constructors

Public methods

FindAutocompletePredictionsRequest
abstract @Nullable CancellationToken

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

abstract List<String>

Gets the list of countries that restrict the location of the results.

abstract @Nullable Integer

Gets the zero-based Unicode character offset indicating the cursor position in the query.

abstract @Nullable LocationBias

Gets the location bias applied for autocomplete predictions.

abstract @Nullable LocationRestriction

Gets the location restriction applied for autocomplete predictions.

abstract @Nullable LatLng

Gets the location where getDistanceMeters is calculated from.

abstract @Nullable String

Gets the user query string used to generate autocomplete predictions.

abstract @Nullable String

Gets the region code specified as a CLDR two-character region code.

abstract @Nullable AutocompleteSessionToken

Gets the AutocompleteSessionToken for this request.

abstract @Nullable TypeFilter

This method is deprecated.

Use setTypesFilter and getTypesFilter instead.

abstract List<String>

Gets the filter that restricts the type(s) of results returned from the response.

abstract FindAutocompletePredictionsRequest.Builder

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

FindAutocompletePredictionsRequest.Builder
setCountries(String[] countries)

See setCountries.

abstract FindAutocompletePredictionsRequest.Builder
setCountries(List<String> countries)

Sets the list of countries that restrict the location of the results.

FindAutocompletePredictionsRequest.Builder
setCountry(@Nullable String countryCode)

This method is deprecated.

Use setCountries instead.

abstract FindAutocompletePredictionsRequest.Builder

Sets the zero-based Unicode character offset indicating the cursor position in the query.

abstract FindAutocompletePredictionsRequest.Builder

Sets the location bias applied for autocomplete predictions.

abstract FindAutocompletePredictionsRequest.Builder
setLocationRestriction(
    @Nullable LocationRestriction locationRestriction
)

Sets the location restriction applied for autocomplete predictions.

abstract FindAutocompletePredictionsRequest.Builder

Sets the location where getDistanceMeters is calculated from.

abstract FindAutocompletePredictionsRequest.Builder

Sets the user query string used to generate autocomplete predictions.

abstract FindAutocompletePredictionsRequest.Builder

Sets the region code specified as a CLDR two-character region code.

abstract FindAutocompletePredictionsRequest.Builder

Sets the AutocompleteSessionToken for this request.

abstract FindAutocompletePredictionsRequest.Builder

This method is deprecated.

Use setTypesFilter instead.

abstract FindAutocompletePredictionsRequest.Builder
setTypesFilter(List<String> placeTypes)

Sets the filter that restricts the type(s) of results returned from the response, up to 5 place types are supported.

Public constructors

Builder

public Builder()

Public methods

getCancellationToken

public abstract @Nullable CancellationToken getCancellationToken()

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

getCountries

public abstract List<StringgetCountries()

Gets the list of countries that restrict the location of the results.

See setCountries for details.

getInputOffset

public abstract @Nullable Integer getInputOffset()

Gets the zero-based Unicode character offset indicating the cursor position in the query.

getLocationBias

public abstract @Nullable LocationBias getLocationBias()

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

getLocationRestriction

public abstract @Nullable LocationRestriction getLocationRestriction()

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

getOrigin

public abstract @Nullable LatLng getOrigin()

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

getQuery

public abstract @Nullable String getQuery()

Gets 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()

Gets the region code specified as a CLDR two-character region code.

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

getSessionToken

public abstract @Nullable AutocompleteSessionToken getSessionToken()

Gets the AutocompleteSessionToken for this request.

getTypeFilter

public abstract @Nullable TypeFilter getTypeFilter()

Gets the filter that restricts the type of the results included in the response.

Possible values:

getTypesFilter

public abstract List<StringgetTypesFilter()

Gets the filter that restricts the type(s) of results returned from the response.

If you enable Places API then a comprehensive list of the supported types can be found in PlaceTypes. The type collections specified in table 3 must be passed in as solo entries and cannot be combined with any other entries from table 1 or 2.

If you enable Places API (New), then types passed here are treated as primary types.

setCancellationToken

public abstract FindAutocompletePredictionsRequest.Builder setCancellationToken(@Nullable CancellationToken cancellationToken)

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

setCountries

public FindAutocompletePredictionsRequest.Builder setCountries(String[] countries)

See setCountries.

setCountries

public abstract FindAutocompletePredictionsRequest.Builder setCountries(List<String> countries)

Sets the list of countries that restrict the location of the results.

This must be a list of ISO 3166-1 Alpha-2 country codes (case insensitive). If empty, country restrictions will not be applied.

This will override values set with setCountry.

Up to five countries are supported. See the components parameter here.

setCountry

public FindAutocompletePredictionsRequest.Builder setCountry(@Nullable String countryCode)

See setCountries for details.

This will override countries set with setCountries.

setInputOffset

public abstract FindAutocompletePredictionsRequest.Builder setInputOffset(@Nullable Integer inputOffset)

Sets the zero-based Unicode character offset indicating the cursor position in the query.

setLocationBias

public abstract FindAutocompletePredictionsRequest.Builder setLocationBias(@Nullable LocationBias locationBias)

Sets the location bias applied for autocomplete predictions. If null, location biases will not be applied.

Note: the autocomplete predictions will not necessarily be within the location specified. To enforce a restriction, use setLocationRestriction. You may not set both LocationBias and LocationRestriction simultaneously.

The supported LocationBias type is based on which API version you are using. With Places API (New) enabled, both RectangularBounds and CircularBounds are supported. While if you enable Places API, only RectangularBounds is supported.

setLocationRestriction

public abstract FindAutocompletePredictionsRequest.Builder setLocationRestriction(
    @Nullable LocationRestriction locationRestriction
)

Sets the location restriction applied for autocomplete predictions. If null, location restrictions will not be applied.

To impose a location bias instead, use setLocationBias. You may not set both LocationBias and LocationRestriction simultaneously.

The supported LocationRestriction type is based on which API version you are using.

If you enable Places API (New), both RectangularBounds and CircularBounds are supported. While if you enable Places API, only RectangularBounds is supported.

setOrigin

public abstract FindAutocompletePredictionsRequest.Builder setOrigin(@Nullable LatLng origin)

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

setQuery

public abstract FindAutocompletePredictionsRequest.Builder setQuery(@Nullable String query)

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

setRegionCode

public abstract FindAutocompletePredictionsRequest.Builder setRegionCode(@Nullable String regionCode)

Sets the region code specified as a CLDR two-character region code.

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

setSessionToken

public abstract FindAutocompletePredictionsRequest.Builder setSessionToken(@Nullable AutocompleteSessionToken sessionToken)

Sets the AutocompleteSessionToken for this request.

setTypeFilter

public abstract FindAutocompletePredictionsRequest.Builder setTypeFilter(@Nullable TypeFilter typeFilter)

Sets the filter that restricts the type of the results included in the response.

Possible values:

This property will be ignored if typesFilter is set using setTypesFilter}.

setTypesFilter

public abstract FindAutocompletePredictionsRequest.Builder setTypesFilter(List<String> placeTypes)

Sets the filter that restricts the type(s) of results returned from the response, up to 5 place types are supported.

This will override setTypeFilter if both are used.

If you enable Places API then a comprehensive list of the supported types can be found in com.google.android.libraries.places.api.model.PlaceTypes. The type collections specified in table 3 must be passed in as solo entries and cannot be combined with any other entries from table 1 or 2.

If you enable Places API (New), then types passed here are treated as primary types.

Parameters
List<String> placeTypes

a list of PlaceTypes