How to determine location of device in Android using IP address

前端 未结 5 1858
忘掉有多难
忘掉有多难 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:57

    Checkout Google Maps Geolocation API

    Sample POST:

    https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_API_KEY
    

    Sample response:

    {
      "location": {
        "lat": 51.0,
        "lng": -0.1
      },
      "accuracy": 1200.4
    }
    

    Limits:

    Users of the standard API:

    2,500 free queries per day 10 query per second, per user Enable pay-as-you-go billing to unlock higher quotas:

    $0.50 USD / 1000 additional queries, up to 100,000 daily.

    MORE

提交回复
热议问题