0

I need to get the list of cities (in English) as Google Maps/places knows them in order for the user to enter his location (not his current one so I can't use the GPS).

I tried using this https://developers.google.com/places/documentation/autocomplete but it doesn't work smoothly, the user needs to enter several characters before it does something and if he has even the smallest typo (for example missing ' character in the name), it won't work. The user has to know too much about how to exactly spell it in English for this to work.

I found several DBs with this info but checking out the names, they were not fully compatible with how Google spells them so it's kinda useless. Is there any way of either getting the list of cities per country or is there a better way to do the auto complete?

Amos
  • 1,321
  • 2
  • 23
  • 44
  • Google's pretty good with alternate spellings, so whatever list you found may not be useless. Have you tried using one of the ones that differs? – Scott Feb 21 '15 at 20:37
  • I tried a street name that contains a ' and it didn't give me any results. only after adding the ' to my typing, it shows me what I was expecting – Amos Feb 22 '15 at 21:48
  • Do you have an example of a city that your DB spells differently than Google Maps? – Scott Feb 22 '15 at 22:51

1 Answers1

0

Alternatively you can use an external library to get all countries, states and cities with one line of code, i already have answered a similar question, check this answer please
Get Countries list along with their states and cities

Here is a code sample

// Fetch all countries with their cities and states
List<Country> countries = Localisation.getAllCountriesStatesAndCities();