Failed to start autocomplete Google Places app api

I want to autocomplete some places using google places api. I only want to include certain places from a specific area. The Googles APIs describe this function using the setBoundsBias function, but I cannot get it to work properly, as it still returns results outside the specified scope.

 try { Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY) .setBoundsBias(new LatLngBounds( new LatLng(16.371163, 21.051073), new LatLng(16.725743, 21.424006))) .build(getActivity()); startActivityForResult(intent, requestCode); } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } 
+7
android google-play-services google-places-api
source share
1 answer

setBoundsBias return results outside the scope. This is just bias. If you want exclusively to return results from limits, you should use AutocompleteFilter . Unfortunately, at present, the only filtering level by region is the country.

0
source share

All Articles