A wrapper that gets weather information from OpenWeatherMap

Overview

open-weather-retriever-z

This is a wrapper that makes getting weather information from OpenWeatherMap a whole lot easier. What seperates this from other wrappers is that, in addition to the basic weather information, it allows free openweathermap user to get up to 5 days of daily forecast information, which typically requires a developer account with OpenWeatherMap(180USD/month). Please note that this is not a hack, instead the library calculates the 3-hour forecast information that free users get, summarize those values, and return it as daily forecast.

Getting Started

Dependency

Step 1: Add jcenter to your repository in project's build.gradle file:

repositories {
    ...
    ...
    jcenter()
}

Step 2: In module's build.gradle add the following dependency:

dependencies {
    ... 
    ... 
    compile 'com.ftoslab:openweatherretrieverz:0.1.4'
}

Available Information

Current Weather Information:

  • current temperature
  • current maximum temperature
  • current minimum temperature
  • short and long weather description
  • weather icon link from OpenWeatherMap
  • pressure
  • humidity
  • windspeed
  • 3-hour rain volume
  • 3-hour snow volume

5 Day Forecast:

  • daily average temperature
  • daily high temperature
  • daily low temperature
  • weather description
  • weather icon link from OpenWeatherMap
  • average pressure
  • average humidity
  • average wind speed
  • rain volume projected
  • snow volume projected

Tools:

  • convert all units to Metric
  • convert all units to Imperial
  • temperature converter

Initialization

// Initialize OpenWeatherRetrieverZ by passing in  your openweathermap api key
OpenWeatherRetrieverZ retriever = new OpenWeatherRetrieverZ(API_KEY);
/*
You can retrieve weather information with either OpenWeatherMap cityID or geolocation(Latitude, Logitude)
*/
retriever.updateCurrentWeatherInfo("6167865", new WeatherCallback() {
  @Override
  public void onReceiveWeatherInfo(CurrentWeatherInfo currentWeatherInfo) {
  	// Your code here
  }
  
  @Override
  public void onFailure(String error) {
    // Your code here
  }
});
retriever.updateDailyForecastInfo("6167865", new DailyForecastCallback() {
  @Override
  public void onReceiveDailyForecastInfoList(List<DailyForecastInfo> dailyForecastInfoList) {
  	// Your code here
  }
  
  @Override
  public void onFailure(String error) {
  	// Your code here
  }
});

Both updateCurrentWeatherInfo and updateDailyForecastInfo are async, which means the main thread won't hang there and wait for the operation to finish. Instead, callback functions will be called when the information became available or when something went wrong.

Example

You can find an example app here

Notes

The ArrayList you get from updateDailyForecastInfo starts from the same day you request it (index 0, day 1), and you will be able to get forecast up until day 6 around the same time, which means the forecast on day 6 might not cover the whole day. This is because as a free user, you only get 40 pieces of 3-hour forecast information (5 days starting from the time you request it). To check how many pieces of 3-hour data for a particular day, you can make use of the function getDataCount() on DailyForecastInfo.

Contribution

The project is still in its preliminary phase, any contribution is welcomed and appreciated. I will review all the pull requests. If you find any bug or just wanna throw in a thought, feel free to create an issue!

License

Copyright 2017 FTOSLab.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
Graph weather widget for Android
Graph weather widget for Android

This app is a fork of aix weather widget which is no longer actively developed. It is a compact graphical weather graph as a single row Android widget. The source code is made public domain as it may provide utility for others. Please respect the various APIs used by the app, and please modify the user agent if you are running a modified version of the app.

An open sourced Weather App made using OpenWeatherMapAPI
An open sourced Weather App made using OpenWeatherMapAPI

An open sourced Weather App made using OpenWeatherMapAPI

A weather app, submission for hack-it-out SGSITS

ProjectSunshine A weather app, submission for hack-it-out SGSITS Introduction This is weather app which shows 3 hour weather forecast upto the next 5

School project: Weather forecast application made in android studio using Kotlin, SQLite and OpenWeatherMaps free API.
School project: Weather forecast application made in android studio using Kotlin, SQLite and OpenWeatherMaps free API.

A*star 4-cast School project made in android studio using Kotlin, SQLite and free API from OpenWeatherMap.org. A weather forecast app with C(U)RD oper

Weather App Built With Kotlin
Weather App Built With Kotlin

WeatherApp In this project, I showed the user the nearby locations with the data I got from the GPS, and I made the details of the weather events of t

A simple and minimalistic weather forecasting android app.
A simple and minimalistic weather forecasting android app.

Ohayō is a minimalistic weather forecast application developed using Kotlin language Screenshoots Technologies Used Jetpack navigation MVVM Arch

Weather App using Retrofit Kotlin Android

NewsFeed Built an Android App which displays current weather and weather forecast of a selected city to the user. Features Coroutines Hilt JSON Parsin

Shumba money weather app, using openweather api and retrofit
Shumba money weather app, using openweather api and retrofit

Shumba Money Weather App Language KOTLIN Libraries used 1.) Retrofit library - REST Client for Java and Android. It makes it relatively easy to retrie

A weather app demo made to play around with Kotlin Multiplatform.
A weather app demo made to play around with Kotlin Multiplatform.

A weather app demo made to play around with Kotlin Multiplatform. Running on Desktop, Ios and Android with all of the business logic being shared across all three platforms!

Owner
Zack Chiu
Zack Chiu
⛈ Weather app with OpenWeatherMap API.

⛈ Weather app with OpenWeatherMap API. Here i demonstrate the use of Modern Android development tools - (Kotlin, Architecture Components, MVVM, LiveData, Material Components)

Shashank Singhal 154 Dec 31, 2022
A weather app for Android using OpenWeatherMap with MVVM + Clean Architecture

Weather App ?? Weather App for Android that shows 16 days forecast for Paris, France - Made with Hilt, Coroutines, Retrofit, ViewModel, Navigation bas

Waseef Akhtar 7 Oct 4, 2022
Android weather forecast app, which uses OpenWeatherMap API

Weather App ?? Android weather forecast app, which uses OpenWeatherMap API About Simple, free and fast weather API from OpenWeatherMap you have access

Ritesh 6 May 17, 2022
null 0 Jan 7, 2022
☁️🌤🌧☀ Weather Android application that gives you the weather information of your saved location or any region you are looking for☁️🌤🌧☀

☁️????☀ Weather Android application that gives you the weather information of your saved location or any region you are looking for☁️????☀

Nisa Efendioğlu 4 Apr 6, 2022
WeatherProject - Weather Project using GPS data and the weather from the API based on the search

WeatherProject In this project, I showed the weather at the current location usi

null 6 Apr 26, 2022
Weather-app - Making Weather application using retrofit from api

weather-app Motivasyon Hava Durumu uygulamasını api'den retrofit kullanarak yapm

İsa Kulaksız 0 Nov 2, 2022
Advanced Android Weather App using MVVM Architecture Sample (ViewModel + LiveData + Kotlin + volley) = Weather App

Advanced Android Weather App using MVVM Architecture Sample (ViewModel + LiveData + Kotlin + volley) = Weather App Video Weather.-.HD.720p.mov Introdu

wykee2 4 Jul 12, 2022
Movo (Movie Information) is an android application to find out all the Movie Information and Details.

Movo About The Project Screen.Recording.2022-08-12.at.08.53.46_1.mp4 Movo (Movie Information) is an android application to find out all the Movie Info

Reihan Fatilla 4 Sep 28, 2022
Project BlueWeather is an android app that lists the closest locations to you and shows the 7-day weather forecast for the location you select.

Project BLUEWEATHER Description Project BlueWeather is a weather forecast application for android. It lists the locations closest to you. It then prov

Burak Unutmaz 4 May 12, 2021