1
- ### Welcome to GeoIp-android [ ![ ] ( https://jitpack.io/v/seventhmoon/GeoIp-android.svg )] ( https://jitpack.io/#seventhmoon/GeoIp-android )
1
+ ### Welcome to GeoIp-android
2
2
This is a wrapper of [ IP-API] ( http://ip-api.com/json ) for Android platform using Volley.
3
3
In simple words, get your location information by IP address.
4
4
5
+ [ ![ ] ( https://jitpack.io/v/seventhmoon/GeoIp-android.svg )] ( https://jitpack.io/#seventhmoon/GeoIp-android )
6
+
5
7
### Sample Application
6
8
Sample Application is included in [ app] ( https://github.com/seventhmoon/GeoIp-android/tree/master/app )
7
9
@@ -27,21 +29,22 @@ Step 2. Add the dependency
27
29
}
28
30
29
31
### 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
- }
43
32
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
45
48
public void onFailure(Call<GeoIpResponseModel> call, Throwable t) {
46
49
Toast.makeText(getApplicationContext(), t.toString(), Toast.LENGTH_SHORT).show();
47
50
}
0 commit comments