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.guidofawkes045:IpApi:2.0.5'
}
dependencies {
implementation("com.github.guidofawkes045:IpApi:2.0.5")
}
<dependency>
<groupId>com.github.guidofawkes045</groupId>
<artifactId>IpApi</artifactId>
<version>2.0.5</version>
</dependency>
libraryDependencies += "com.github.guidofawkes045" % "IpApi" % "2.0.5"
:dependencies [[com.github.guidofawkes045/IpApi "2.0.5"]]
This is a wrapper of IP-API for Android platform using Volley. In simple words, get your location information by IP address.
Sample Application is included in app
To get a Git project into your build:
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.seventhmoon:GeoIp-android:1.0.0'
}
ApiManager apiManager = new ApiManager(Volley.newRequestQueue(context));
apiManager.getGeoIpInfo(new Response.Listener<GeoIpResponseModel>() {
@Override
public void onResponse(GeoIpResponseModel response) {
//This is how you get the information.
//not all attribute are listed
String country = response.getCountry();
String city = response.getCity();
String countryCode = resopnse.getCountryCode();
double latitude = response.getLatitude();
double longtidue = response.getLongitude();
String region = response.getRegion();
String timezone = response.getTimezone();
String isp = response.getIsp();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
String errorMessage = error.toString();
}
});