Reputation: 8021
I'm trying to pass an autocomplete prediction request to google places api. Everything works, however I'm having problems with the bounds parameter. Even when bounds is 500 meters surrounding the user's current location (I verified that the lat/lngs were correct on a map) the api still insists on returning results located in other countries (as well as the relevant results that are actually located within 500 meters from the user).
Code:
PendingResult<AutocompletePredictionBuffer> results =
Places.GeoDataApi
.getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
mBounds, null);
what could be the cause of this unusual behavior? Specifically the unnecessary results are the names of cities/towns in other countries.
Upvotes: 4
Views: 469
Reputation: 191
The bounds
parameter on getAutocompletePredicitons
signifies a bias towards a particular geographic area - see the documentation here. It is not possible to hard-restrict the result set to a particular country or geographic region today.
Upvotes: 2