PDA

View Full Version : How to find the location of the user?



nikhilqt
14th December 2010, 13:21
Hi,

I want to find from where the user has executing the application. The location need to be on the level of the country. Is there any way where i can find the same? Please give me some ideas to start with.

Thanks in advance,
Nikhil

high_flyer
14th December 2010, 13:53
Is the application connected to the Internet?

nikhilqt
14th December 2010, 13:59
yes. It is connected to internet. Is it possible to get the location from the IP address using Qt ?

high_flyer
14th December 2010, 14:09
sure - it has nothing to do with Qt itself.
Google about IP address resolution.

nikhilqt
14th December 2010, 14:25
yeah, I checked some of the sites offering this, but if i input the IP the values are not as expected. Anyways i will check again. Thanks. Please let me know if you got anything more on this. Thanks.

chris_helloworld
14th December 2010, 16:23
Geographic location via IP address is always going to be hit and miss affair. The user could be going via a proxy etc..

One other thing you could use, (also it wont always be accurate), would be to use the system locale.

I'm presuming your app isnt on a mobile phone with access to GPS as this would be the only 100% reliable way of getting a location.

SixDegrees
14th December 2010, 17:27
GeoIP is a nice database, and there's a free version that's updated once per month. It's quite accurate within the US and Europe, possibly not so much elsewhere. You need access to a web server in order to run it.

As noted above, determining locaiton from IP address is never going to be foolproof.

squidge
14th December 2010, 19:22
As long as you don't need to be more accurate than "UK" or such like, using IP lookup should be OK most of the time, as long as you don't depend on the local IP address (as that could be masqueraded)

You could look into Google's location aware services - these will give you town/city level information (eg. West Bromwich, UK), but you need to sign up with Google to get them and you must also ask the user for permission first. It also depends on the user having location aware devices such as a mobile phone or other device which can detect cellular towers.