[英]How can I get phone area code from MaxMind's GeoLite2 City local mmdb and associated Java API?
The "areaCode" seems to be missing from the CityResponse that is returned using the locally loaded mmdb database and MaxMind's Java Client API. 使用本地加载的mmdb数据库和MaxMind的Java客户端API返回的CityResponse中似乎缺少“ areaCode”。 The API service call version seems to have this.
API服务调用版本似乎具有此功能。
I am using this: 我正在使用这个:
reader = new DatabaseReader.Builder(database)
.withCache(new CHMCache()).build();
}
After I setup the reader I use this: 设置阅读器后,我将使用以下代码:
InetAddress ipAddress = InetAddress.getByName(ip);
CityResponse response = reader.city(ipAddress);
The returned json in response has everything except 'areaCode" whearas the Web service call has areaCode. 作为响应,返回的json包含除“ areaCode”外的所有内容,因为Web服务调用具有areaCode。
If I switch to legacy java ApI using local .DAT loaded file, would I get the 'areaCode' as well ? 如果我使用本地.DAT加载的文件切换到旧版Java ApI,我也会得到“ areaCode”吗?
The area code is not included in GeoIP2 . 区号不包含在GeoIP2中 。 GeoIP City Legacy does include the area code.
GeoIP City Legacy确实包含区号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.