I am using Places.GeoDataApi for Android and I get different search results depending on the location of the device performing the request. I need the results to be consistently located inside the bounds. I don't see where that could be setup in the getAutocompletePredictions request. Is there anything I am missing?
I get address/place autocomplete suggestions using the GoogleApiClient and Places API through:
Places.GeoDataApi.getAutocompletePredictions()
The method requires a GoogleApiClient object, a String to autocomplete, and a LatLngBounds object to limit the search range. This is what my usage looks like:
LatLngBounds bounds = new LatLngBounds(new LatLng(38.46572222050097, -107.75668023304138),new LatLng(39.913037779499035, -105.88929176695862));
GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.build();
PendingResult<AutocompletePredictionBuffer> results =
Places.GeoDataApi.getAutocompletePredictions(googleApiClient, "Starbucks", bounds, null);
Version in use: com.google.android.gms:play-services-location:8.3.0
Documentation:
https://developers.google.com/places/android/autocomplete
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…