Giter VIP home page Giter VIP logo

ipapi-retrofit's Introduction

Welcome to IpApi-retrofit

This is a wrapper of IP-API for Android platform using Retrofit. In simple words, get your location information by IP address. (for volley version, please visit https://github.com/seventhmoon/ipapi-volley)

Sample Application

Sample Application is included in app

How to install

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:ipapi-retrofit:1.5.0'
}

How to use

  GeoIpService ipApiService = ServicesManager.getGeoIpService();
  ipApiService.getGeoIp().enqueue(new Callback<GeoIpResponseModel>() {
      @Override
      public void onResponse(Call<GeoIpResponseModel> call, retrofit2.Response<GeoIpResponseModel> response) {
          String countryName = response.body().getCountryName();
          String city = response.body().getCity();
          String country = resopnse.body().getCountry();
          double latitude = response.body().getLatitude();
          double longtidue = response.body().getLongitude();
          String region = response.body().getRegion();
          String timezone = response.body().getTimezone();
          String isp = response.body().getIsp();
      }

      @Override
      public void onFailure(Call<GeoIpResponseModel> call, Throwable t) {
          Toast.makeText(getApplicationContext(), t.toString(), Toast.LENGTH_SHORT).show();
      }
    });

ipapi-retrofit's People

Contributors

seventhmoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ipapi-retrofit's Issues

Wrong value returns. (1.4.5)

                GeoIpResponseModel model = response.body();
                String country = model.getCountry();
                String countryCode = model.getCountryCode();

Here, country returns countryCode & countryCode returns null.

Wrong Information

For Most of the places it returns wrong location information...

please fix it....

is this service have any limitation?

is this service have any limitation?
for example request per hour.
can I count on this library for using in my app to work on long time?
thanks and best regards

Sometimes cannot get information from some devices.

Hi, Thank you very much for providing us with good library.
But sometimes cannot get information from some devices such as "Android SHARP SHV39 8.0.0".
If the first two times do not get the information and run it again, then success to get information.
Is this error? I want to your help.

Lat and Lng return NULL

hi, thank's for this ...
i use this two line code:

double latitude = response.body().getLatitude();
double longtidue = response.body().getLongitude();

but return null ... how to fix this problem!?

request 403 for version 1.5.2

i'm receiving 403 while trying to fetch data.
what could be the reason!!

Response{protocol=h2, code=403, message=, url=https://ipapi.co/json}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.