quangson91
quangson91

Reputation: 1094

Limiting result in country with Google Place autocomplete?

I just tried this demo, but I can't find how to limit result in country. I also checked getAutocompletePredictions in com.google.android.gms.location.places.GeoDataApi, but I can't found any document to implement limiting country.

I also searched some questions in SO; apparently it's JavaScript and needs to add some "optional param". So how to add optional param in this request?

Upvotes: 5

Views: 3609

Answers (2)

Anton R
Anton R

Reputation: 519

should be this way, but it doesn't work, due to a bug in google play service library v7?

List<Integer> autocompleteFilter = new ArrayList<Integer>();
autocompleteFilter.add(Place.TYPE_COUNTRY);

// Set up the adapter that will retrieve suggestions from the Places Geo Data API that cover
// the entire world.
mAdapter = new PlaceAutocompleteAdapter(this, android.R.layout.simple_list_item_1,
BOUNDS_JAKARTA, AutocompleteFilter.create(autocompleteFilter));

Upvotes: 0

chings228
chings228

Reputation: 1889

https://developers.google.com/places/webservice/search

  1. you can add the country name in the query , such as "in australia" to limit search in australia

or

2 . add a radius parameter to limit the search

Upvotes: 2

Related Questions