Skip to content

Commit 7217052

Browse files
authored
Update README.md
1 parent 812c61a commit 7217052

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
### Welcome to GeoIp-android [![](https://jitpack.io/v/seventhmoon/GeoIp-android.svg)](https://jitpack.io/#seventhmoon/GeoIp-android)
1+
### Welcome to GeoIp-android
22
This is a wrapper of [IP-API](http://ip-api.com/json) for Android platform using Volley.
33
In simple words, get your location information by IP address.
44

5+
[![](https://jitpack.io/v/seventhmoon/GeoIp-android.svg)](https://jitpack.io/#seventhmoon/GeoIp-android)
6+
57
### Sample Application
68
Sample Application is included in [app](https://github.com/seventhmoon/GeoIp-android/tree/master/app)
79

@@ -27,21 +29,22 @@ Step 2. Add the dependency
2729
}
2830
2931
### How to use
30-
IpApiService ipApiService = ServicesManager.getGeoIpService();
31-
ipApiService.getGeoIp().enqueue(new Callback<GeoIpResponseModel>() {
32-
@Override
33-
public void onResponse(Call<GeoIpResponseModel> call, retrofit2.Response<GeoIpResponseModel> response) {
34-
String country = response.body().getCountry();
35-
String city = response.body().getCity();
36-
String countryCode = resopnse.body().getCountryCode();
37-
double latitude = response.body().getLatitude();
38-
double longtidue = response.body().getLongitude();
39-
String region = response.body().getRegion();
40-
String timezone = response.body().getTimezone();
41-
String isp = response.body().getIsp();
42-
}
4332

44-
@Override
33+
IpApiService ipApiService = ServicesManager.getGeoIpService();
34+
ipApiService.getGeoIp().enqueue(new Callback<GeoIpResponseModel>() {
35+
@Override
36+
public void onResponse(Call<GeoIpResponseModel> call, retrofit2.Response<GeoIpResponseModel> response) {
37+
String country = response.body().getCountry();
38+
String city = response.body().getCity();
39+
String countryCode = resopnse.body().getCountryCode();
40+
double latitude = response.body().getLatitude();
41+
double longtidue = response.body().getLongitude();
42+
String region = response.body().getRegion();
43+
String timezone = response.body().getTimezone();
44+
String isp = response.body().getIsp();
45+
}
46+
47+
@Override
4548
public void onFailure(Call<GeoIpResponseModel> call, Throwable t) {
4649
Toast.makeText(getApplicationContext(), t.toString(), Toast.LENGTH_SHORT).show();
4750
}

0 commit comments

Comments
 (0)