问题
My requirement is to get country name by device Ip. Without any WEB/API calls. I googled well but I cannot conclude anything. We have good free service MaxMind but it provides CSV format as well its very huge in file size. Do we have any suggested way.? We should not use location based service like GPS/Network Provider..?
please helps me to fix this out..
回答1:
You can use http://freegeoip.net/
It allows up to 10,000 queries per hour by default.
It uses json parsing you can easily implement
For ex: http://freegeoip.net/json/github.com
gives this
{"ip":"192.30.252.130","country_code":"US","country_name":"United States","region_code":"CA","region_name":"California","city":"San Francisco","zip_code":"94107","time_zone":"America/Los_Angeles","latitude":37.77,"longitude":-122.394,"metro_code":807}
with Country Code and Country Name
回答2:
You can consider IPInfoDB API http://www.ipinfodb.com
It is fast API using data delivery network (DDN). It allows 2 connections per second by default.
http://api.ipinfodb.com/v3/ip-city/?key=your_api_key&ip=74.125.45.100
来源:https://stackoverflow.com/questions/33516266/getting-country-name-by-ip-address-in-android