Home > other >  How can I get phone area code from MaxMind's GeoLite2 City local mmdb and associated Java API?
How can I get phone area code from MaxMind's GeoLite2 City local mmdb and associated Java API?

Time:01-10

The "areaCode" seems to be missing from the CityResponse that is returned using the locally loaded mmdb database and MaxMind's Java Client API. The API service call version seems to have this.

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.

If I switch to legacy java ApI using local .DAT loaded file, would I get the 'areaCode' as well ?

CodePudding user response:

The area code is not included in GeoIP2. GeoIP City Legacy does include the area code.

  • Related