Reputation: 2385
I want to set google place auto complete text box, but I want the user only to see those places listed, which are in under 5 Km by set location. I don't talk about near-by search. I tried google map API, but it does not show correctly. I used this API.
Upvotes: 6
Views: 1505
Reputation: 158
You can use LatLng Bounds to Restrict Places usage
There is a workaround to do this , but involves a little bittle computation
Current Location + Distance in North Direction = new LatLngBounds;
currentLocation + south Direction (possibly you have to convert km to radians) = new SouthBounds;
and Add Bounds to widget
myPlaceAutoComplete.setBounds(northBounds,southBounds)
Upvotes: 0
Reputation: 563
Your issue is probably because your radius is 500. Try changing it to 5000.
The places autocomplete webservice documentation says the radius should be in meters.
tl;dr
Try this link
Upvotes: 0