简体   繁体   中英

How to get the current user geo location in Java?

I saw that in different web services (eg on Twitter or Facebook, but there also others) they are able to say what the geo location of the user is. Are there any libraries in Java for this kind geolocation?

I'm thinking about building a we service which would depend o the geo location of the user.

Please notice that I'm not talking here about geolocation on mobile devices, I would like to get the location of the user who uses his web broawser on his/her desktoo computer.

The biggest DB with WiFi-to-location is Skyhook wireless. You can get the SDK from here : Skyhook Location SDK

It has not fully coverage, but it's the best in my opinion(Google and Apple use it).

They are maintaining huge IP databases for tracking user geo location based on host.

And as a individual it's not possible to maintain all those host mapping. So for this you have to bye IP table form third party provider.

However if you want, you can get the location details viz city,region,country,longitude,latitude from request header.

It's only available for GAE user(IP table is maintained by google).

If you want you can host a sample application at GAE and use webservice call to get location details(SOA) from your server.Particularly i am talking for non-GAE user.

For more details go through GAE ReleaseNotes

    country     =   request.getHeader("X-AppEngine-Country"); 
    region      =   request.getHeader("X-AppEngine-Region");
    city        =   request.getHeader("X-AppEngine-City");
    temp        =   request.getHeader("X-AppEngine-CityLatLong");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM