Code Monkey home page Code Monkey logo

open-weather-api-wrapper's Introduction

Open-Weather-API-Wrapper

Download Twitter Build Status

sun.png

Open Weather API Wrapper is an Android wrapper for the APIs of https://openweathermap.org. This library handles all the network operations and parameter validations on behalf of the developer.

##Dependency:

  • Add below lines to app/build.gradle file of your project.
dependencies {
    compile 'com.kevalpatel2106:open-weather-wrapper:1.0'
}

##How to use this library?:

  • Initialization:

Initialize the library in your launch activity by providing the open weather api key and the unit system you want to use throughout the application. If you don't have the open weather api key, you can generate it from here.

   OpenWeatherApi.initialize("YOUR API KEY", Unit.STANDARD);
  • Accessing the API:

Open weather api provides you functions to access below information:

  • Get current weather for provided city, geo point or postal code.
  • Get three hourly forecast for city or, geo point.
  • Get the daily forecast for provided city or geo point.

You can get the required information by passing the required parameters. The information will be received in specific listeners.

Here is the example of getting the three hourly forecast of the weather by city name.

OpenWeatherApi.getThreeHoursForecast("Landon,uk", new ForecastListener() {
    @Override
    public void onResponse(WeatherForecast weatherForecasts) {
        //Forecast received.
        //Do someting
    }

    @Override
    public void onError(String message) {
        //Something went wrong.
        //Display the error message to the user.
    }
});

Open Weather API Wrapper uses RxJava and Retrofit to handle the network operations.

##Demo:

  • You can download the sample application from here.

##Contribute:

  • Still there are many open weather apis to implement. Any pull request are most welcome. Simple 3 step to contribute into this repo:
  1. Fork the project.
  2. Make required changes and commit.
  3. Generate pull request. Mention all the required description regarding changes you made.

##Questions: If you have any questions, hit me on twitter @kevalonly77 .

open-weather-api-wrapper's People

Contributors

kevalpatel2106 avatar

Watchers

Michael jentsch avatar  avatar

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.