How to get the user's current city name without using the core location service?

TypingPanda

So the original requirements was that on the launch of the app, the mobile app will get the current location of the user precise to City. Based on the city, the server/app client will give-city related content.

I know it would not be too difficult if I could use the core location service (since you know suspicious (self-concerned) users usually will disable the location service for a not-so-trusting app).

I have searched the web for few hours and get an summary of following solutions where I need your help to decide which one could be my best option or if you have any other better ones.

Using the [NSlocale autoupdatingCurrentLocale]

cons:

  • a.The explanation of the return value of the call from apple's document: "The locale is formed from the settings for the current user’s chosen system locale overlaid with any custom settings the user has specified in System Preferences." From which I don't understand what is "custom settings the user has specified in System Preferences" reference link

  • b. This value could be misleading and not related with user's actual current city/country at all.

comments: I would be appreciated if anybody could explain me how the locale is changed according to user's setting.

Getting the current iPhone TimeZone

NSTimeZone *localTime = [NSTimeZone systemTimeZone];
NSLog(@"Current local timezone  is  %@",[localTime name]); 

cons:

  • a. same as item b above, because user can always specify rather than let the system auto update the time zone.
  • b. precision is comprimised, only capital city will be listed.

comments:Not very promising but easy to implement

Using IP based location detection webservice Based on my reading, the process will involve the app sending a request to a server where the server will record the IP of the request.(Don't think from App itself could get its own IP correctly since it may inside a local network) Based on the IP recorded through some third party service (with a IP db or some other available APIs), it will return the city information back to the client.

cons:

  • a. I've never implemented such thing, don't know if it is feasible for a mobile app.
  • b. Even if it is possible, don't know if it is faster than the core location service.

comments: If you know it is possible for a iOS app to do so please let me know.

Please kindly give me any thoughts you have or suggest any better solution if you know.

Thank you very much.

Swapnil Luktuke

A preventive measure to avoid all your trouble would be to create an app that wouldn't appear 'not-so-trusting' and use core location to get the location. If a user still does not allow your app to know the location and knowing his city is a must, let him select a city from the list of cites for which content is available. Of course this opens up a huge hole allowing use to get the content for ANY city. Only you can decide if this is an acceptable tradeoff for simpler implementation.

If you must know the CITY automatically without core location, the first two options you mentioned, 'locale' and 'time zone' are useless as each of them encompasses large number of cities. Also, as you mentioned they're dependent on user's settings.

So reverse geocoding the IP address of a web service request using GeoIP or some such service is your best bet. You can find a lot of discussion and references for this on the web.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get the user's current city name without using the core location service?

From Dev

How to get user location city without using geo location

From Dev

How can I get city name without current location(lat-long) in iOS?

From Dev

How to get Current Location(Street,City, etc,..) using gps in Android

From Dev

Get current location name of user without using gps or internet but by using Network_Provider in android

From Dev

How to use Facebook Graph API to Get user's location/City using PHP?

From Dev

How to get user's current location in Android

From Dev

How to get user's current location in Android

From Dev

How to get a User's Current Location Using Google Geocode API and PHP

From Java

How to get Current Location using SwiftUI, without ViewControllers?

From Dev

Android: Is there a way to get local city wallpapers by checking the user's location?

From Dev

Get User Current City in Android

From Dev

how to show the street name, postcode/zip-code, city automatically of the current location using maps api v2

From Dev

Get user current and exact location using GPS

From Dev

Get User Current location using CLLocation in IOS

From Dev

Get current user's name and user id

From Dev

How to get the current logged in user using Principal or Account service

From Dev

how get django current user's name both in shell and in request

From Dev

how to get current database and user name using a select in postgresql

From Java

How to get the detailed street name of current location?

From Dev

How to get user current location with lat and long

From Dev

How to get user's location in iOS using google plus sdk?

From Dev

How to get user location without gps or wifi?

From Dev

How to get user location continuosly without GPS

From Dev

How to get the current logged User in a service

From Dev

How to make google maps api get user's current location to be stored it in the database?

From Dev

How to change city name language from location?

From Dev

How can I find users near the current user's location using Parse?

From Dev

Get name of current user

Related Related

  1. 1

    How to get the user's current city name without using the core location service?

  2. 2

    How to get user location city without using geo location

  3. 3

    How can I get city name without current location(lat-long) in iOS?

  4. 4

    How to get Current Location(Street,City, etc,..) using gps in Android

  5. 5

    Get current location name of user without using gps or internet but by using Network_Provider in android

  6. 6

    How to use Facebook Graph API to Get user's location/City using PHP?

  7. 7

    How to get user's current location in Android

  8. 8

    How to get user's current location in Android

  9. 9

    How to get a User's Current Location Using Google Geocode API and PHP

  10. 10

    How to get Current Location using SwiftUI, without ViewControllers?

  11. 11

    Android: Is there a way to get local city wallpapers by checking the user's location?

  12. 12

    Get User Current City in Android

  13. 13

    how to show the street name, postcode/zip-code, city automatically of the current location using maps api v2

  14. 14

    Get user current and exact location using GPS

  15. 15

    Get User Current location using CLLocation in IOS

  16. 16

    Get current user's name and user id

  17. 17

    How to get the current logged in user using Principal or Account service

  18. 18

    how get django current user's name both in shell and in request

  19. 19

    how to get current database and user name using a select in postgresql

  20. 20

    How to get the detailed street name of current location?

  21. 21

    How to get user current location with lat and long

  22. 22

    How to get user's location in iOS using google plus sdk?

  23. 23

    How to get user location without gps or wifi?

  24. 24

    How to get user location continuosly without GPS

  25. 25

    How to get the current logged User in a service

  26. 26

    How to make google maps api get user's current location to be stored it in the database?

  27. 27

    How to change city name language from location?

  28. 28

    How can I find users near the current user's location using Parse?

  29. 29

    Get name of current user

HotTag

Archive