Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.tornaia:java-offline-geoip:java-offline-geoip-0.1.10'
}
dependencies {
implementation("com.github.tornaia:java-offline-geoip:java-offline-geoip-0.1.10")
}
<dependency>
<groupId>com.github.tornaia</groupId>
<artifactId>java-offline-geoip</artifactId>
<version>java-offline-geoip-0.1.10</version>
</dependency>
libraryDependencies += "com.github.tornaia" % "java-offline-geoip" % "java-offline-geoip-0.1.10"
:dependencies [[com.github.tornaia/java-offline-geoip "java-offline-geoip-0.1.10"]]
Clear feedback. Just if you appreciate my efforts!
ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special areas of geographical interest. Read more
GeoIP geoIP = GeoIPProvider.getGeoIP();
Optional<String> optionalCountryIsoCode = geoIP.getTwoLetterCountryCode("50.63.202.32");
// optionalCountryIsoCode: Optional[US]
Optional<String> optionalCountryName = geoIP.getCountryName("50.63.202.32");
// optionalCountryName: Optional[United States]
<dependency>
<groupId>com.github.tornaia</groupId>
<artifactId>java-offline-geoip</artifactId>
<version>0.1.10</version>
</dependency>
The GeoLite2 databases are distributed under the Creative Commons Attribution-ShareAlike 4.0 International License. The attribution requirement may be met by including the following in all advertising and documentation mentioning features of or use of this database:
This product includes GeoLite2 data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.