简体   繁体   English

如何从MaxMind的GeoLite2 City本地mmdb和关联的Java API获取电话区号?

[英]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.

相关问题 在geolite2 .mmdb文件(JAVA)上按城市名称查询 - Query by city name on geolite2 .mmdb file (JAVA) 如何在不使用Asterisk的Java API打开通道的情况下获得与扩展名/对等项相关联的名称? - How can I get the name associated with an extension/peer without having an opened channel with the Asterisk's Java API? 如何在Magnolia CMS中将GeoLite2-Country.mmdb(按IP数据库划分的国家)更新到最新版本? - How to update GeoLite2-Country.mmdb (country by IP database) to newest version in Magnolia CMS? 如何从地理编码器获取城市名称? - How can I get city name from Geocoder? 如何使用Freebase API获取城市的所有旅游景点? 我只能从返回的JSON中获取10 - How to use freebase api to get all the tourist spots of a city? I can only get 10 from the returned JSON MaxMind的GeoIP2 java API线程安全吗? - Is MaxMind's GeoIP2 java API thread-safe? 如何从Java中的shapefile获取城市名称 - how to get the city name from shapefiles in java 如何使用Java API从keycloak获取用户的名字,姓氏和属性? - How can I get a user's first, last name, and attribute from keycloak with the Java API? 如何获取给定城市或地址名称的纬度和经度(java代码)? - how to get Latitude and Longitude of the given Name of the City or Address (java code)? 在Java中使用城市名称获取本地时区 - Get Local timezone using City Name in Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM