PlaceAutocomplete.IntentBuilder

public final class PlaceAutocomplete.IntentBuilder


Builder for an intent to launch the activity.

Summary

Public constructors

Public methods

final @NonNull Intent
build(Context context)

Builds the intent to launch the activity.

final @NonNull PlaceAutocomplete.IntentBuilder
setAutocompleteSessionToken(
    AutocompleteSessionToken autocompleteSessionToken
)

Sets the session token for the autocomplete request(s).

final @NonNull PlaceAutocomplete.IntentBuilder
setAutocompleteUiCustomization(
    AutocompleteUiCustomization autocompleteUiCustomization
)

Sets the UI customization for the widget.

final @NonNull PlaceAutocomplete.IntentBuilder

Sets countries to restrict results to.

final @NonNull PlaceAutocomplete.IntentBuilder
setInitialQuery(String initialQuery)

Sets the initial query in the search input.

final @NonNull PlaceAutocomplete.IntentBuilder

Biases the autocomplete results to a particular area.

final @NonNull PlaceAutocomplete.IntentBuilder

Restricts the autocomplete results to a particular area.

final @NonNull PlaceAutocomplete.IntentBuilder
setOrigin(LatLng origin)

Sets the origin of the autocomplete request.

final @NonNull PlaceAutocomplete.IntentBuilder
setPureServiceAreaBusinessesIncluded(
    boolean isPureServiceAreaBusinessesIncluded
)

Sets whether to include pure service area businesses in the results.

final @NonNull PlaceAutocomplete.IntentBuilder
setRegionCode(String regionCode)

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

final @NonNull PlaceAutocomplete.IntentBuilder

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

Public constructors

IntentBuilder

public IntentBuilder()

Public methods

build

public final @NonNull Intent build(Context context)

Builds the intent to launch the activity.

setAutocompleteSessionToken

public final @NonNull PlaceAutocomplete.IntentBuilder setAutocompleteSessionToken(
    AutocompleteSessionToken autocompleteSessionToken
)

Sets the session token for the autocomplete request(s). If no session token is provided, one will be generated internally.

setAutocompleteUiCustomization

public final @NonNull PlaceAutocomplete.IntentBuilder setAutocompleteUiCustomization(
    AutocompleteUiCustomization autocompleteUiCustomization
)

Sets the UI customization for the widget.

setCountries

public final @NonNull PlaceAutocomplete.IntentBuilder setCountries(List<@NonNull String> countries)

Sets countries to restrict results to.

This must be a list of ISO 3166-1 Alpha-2 country codes (case insensitive). If no countries are set, no country filtering will take place. Up to five countries are supported.

setInitialQuery

public final @NonNull PlaceAutocomplete.IntentBuilder setInitialQuery(String initialQuery)

Sets the initial query in the search input.

setLocationBias

public final @NonNull PlaceAutocomplete.IntentBuilder setLocationBias(LocationBias locationBias)

Biases the autocomplete results to a particular area.

If the bounds are unset or explicitly set to null, the autocomplete results will be biased to the device's approximate location.

setLocationRestriction

public final @NonNull PlaceAutocomplete.IntentBuilder setLocationRestriction(LocationRestriction locationRestriction)

Restricts the autocomplete results to a particular area.

setOrigin

public final @NonNull PlaceAutocomplete.IntentBuilder setOrigin(LatLng origin)

Sets the origin of the autocomplete request.

setPureServiceAreaBusinessesIncluded

public final @NonNull PlaceAutocomplete.IntentBuilder setPureServiceAreaBusinessesIncluded(
    boolean isPureServiceAreaBusinessesIncluded
)

Sets whether to include pure service area businesses in the results.

setRegionCode

public final @NonNull PlaceAutocomplete.IntentBuilder setRegionCode(String regionCode)

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

setTypesFilter

public final @NonNull PlaceAutocomplete.IntentBuilder setTypesFilter(List<@NonNull String> typesFilter)

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

Up to 5 place types are supported. The full list can be found here, and should be considered as the source of truth. 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.