Open Weather API Wrapper

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


  • Add below lines to file app/build.gradle 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 the 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() {
    public void onResponse(WeatherForecast weatherForecasts) {
        //Forecast received.
        //Do someting

    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.

Source code: