0

I'm designing a mobile app (iOS and Android - mobile only) that requires location-specific content to be shown to the user (roughly knowing the user's city is fine for scope). We'd prefer not to use native location services as there are compliance issues with warehousing user data. To get around this we'd like the user to enter a location.

My initial thought is to ask for zip code, but as this app has an international user base, I don't know if zip code is ubiquitous across the world. Asking for city name with an autofill option also requires us to have a table for city names to check against (correct me if I'm wrong), which is developmentally prohibitive as far as I know. Integrating some kind of maps API is also an option, but it's a big hassle we'd like to avoid.

My question is: what is the simplest method of having a user input a location within a city's degree of accuracy?

  • A good friend of mine has worked on a Country/Cities API for this kind of scenario. Might want to check it out. countriesfor.us – Caluso May 8 '15 at 23:10
  • Sorry, but that seems to be exactly what the OS solutions are intended for and they offer the best initial UX, as long as you have some fallback for overrides and when location services are unavailable. – Crissov May 9 '15 at 6:22
  • @Crissov I believe there are compliance issues with automatically pulling users locations even if they are agreeing to location services so we are trying to avoid that. Also going for simplest dev implementation as well so we're really looking for user input that's internationally accurate to a city-level. It's a lot of stupid complications, but unfortunately that's the way it is. – Danny F. May 12 '15 at 14:35
  • @Caluso thanks for the suggestion. i'll look into it. – Danny F. May 12 '15 at 14:35
2

The best solution from a user perspective is probably having a single search field, as we can see on Booking.com.

At the same time, it's also the most complicated to develop.

When designing this type of search field, the main issues you usually need to face are:

  • duplicates (e.g. there are up to 28 "London" in the world, approximately 18 of them in the US);
  • importance (e.g. we can assume the "London" in England is more than the "London" in Ohio. Even within the same country, 2 cities with the same name usually have a different volume of searches);
  • as-you-type suggestions: auto-complete, auto-suggest, and instant results (e.g. let's pretend we're in the UK. When I type "Lon" the first suggestion I get needs to be "London" and not "Long Eaton" in Nottinghampshire). You can use the suggestions also to disambiguate the location of a city, for instance including the region/area name next to the city name (e.g. "London - Greater London - United Kingdom").

If a single, Booking-like search field is too complex to develop, an alternative, simpler solution is to implement a dropdown to select the country + a search field to input the town.

In this way you enable the search within a single country only, reducing the overall complexity of the search algorithm (e.g. excluding cross-country queries).

As always, the best way to discover what is the best solution for your users is to test the app with them :)

  • thanks for the suggestion. a search field is too dev-intensive for this project unfortunately. country and city dropdowns might be the way to go. – Danny F. May 12 '15 at 14:37
0

As the question indicated that Location-based service (LBS) like GPS cannot be utilized.
These SO questions answer your question in Android implementation.

How can i get my android device country code without using GPS?
Where am I? - Get country

To summarize, there are several ways to approximately guess the location without using LBS and involving user input

  • Using IP address (up to City level)

  • Using device language (locale)

  • Using telephony service

Other possible methods:

Bear in mind that it is NOT 100% accurate. But can be served as hints before the user input.


For the zip code, it is not applied to region like Hong Kong.


If you perceived that using API to get city name is troublesome, then you need much more work to maintain a list of city name and circumvent the issues mentioned by @Eleonora Zucconi to avoid user frustration.


There are some apis/database for matching the city name in user input.

Online implementation:
Google Places Autocomplete API

Offline implementation:
How to implement the geo location autocomplete on searching similar to what foursquare official website do?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.