I'm defining my bounds as follow:
private static final LatLngBounds BOUNDS_CHENNAI = new LatLngBounds(
new LatLng(12.8339547, 80.0817007), new LatLng(13.2611661, 80.33632279999999)); // Chennai city bounds.
Creating Goolge API client as follow:
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this,this)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.build();
And using those bounds in adapter as follow:
PendingResult<AutocompletePredictionBuffer> results =
Places.GeoDataApi
.getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
mBounds, mPlaceFilter);
According to the documentation is should return me only location within Chennai city, but it returns me location from around the world.
E.g. When I type "Sola" it returns "Sola road" of Ahmedabad city instead of showing matched results within bounds.
I have the same problem with the bounds in android. I've tried everything and can't solve the problem.
Looking for other web pages, i found this in the documentation for javascript when trying to set bounds to an area:
The results are biased towards, but not restricted to, Places contained within these bounds.
It looks like the android places api documentation is not complete. We will have to wait.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With