Getting the Suggestions from the Current Location when working with Google Places API

StackOverflow https://stackoverflow.com/questions/23627499

  •  21-07-2023
  •  | 
  •  

Pregunta

I'm working with Google Places API which gives the auto suggestions from the keyword mentioned in AutoCompleteTextView. Its working fine.

But when i enter some keyword(some text in the AutoCompleteTextView) it was giving the places according to the Current Location. but i need the places from the United States

Using the following Url to get the places

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=?&types=geocode&sensor=false&AIzaSyAIjrt28Os8Eyp0rVQbdkKNXNi5YrGx0AE

Example

  • "New" text entered
  • Giving the places near to my CurrentLocation..(Places near current location)
  • Expected Places from the UnitedStates.. (NewYork, NewBerlin, NewLenox)

Please can i get any luck

Thank you

¿Fue útil?

Solución

Refering to this article you can pass a location and a radius as parameter to your query which should be a solution to your problem. As location you could pass the middle of the United States and a radius that fits to all borders.

Taking this similar question into consideration this seems to be impossible other than the way I described it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top