How to determine location of device in Android using IP address

前端 未结 5 1792
忘掉有多难
忘掉有多难 2021-02-04 05:21

I am developing an Android app. I want to determine the location of the device using its IP address. Where do I start? The links on Google APIs are not conclusive enough. Thanks

5条回答
  •  长情又很酷
    2021-02-04 05:59

    There are several web-services, which provides you latitude and longitude value from IP address.

    one such is api.ipinfodb.com

    for ex, you can latitude and longitude by sending request like

     http://api.ipinfodb.com/v3/ip-city/?key=
                   &ip=74.125.45.100&format=json
    

    this returns the data in json format and you can get response in XML by setting format=xml.(you need to register to get your API key).

    or you can download database from this and this link.

    you can download datasets but u have to constantly update it.

提交回复
热议问题