All Projects → KwabenBerko → OpenWeatherMap-Android-Library

KwabenBerko / OpenWeatherMap-Android-Library

Licence: MIT license
A wrapper for the openweathermap REST API

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to OpenWeatherMap-Android-Library

OWM-JAPIs
Java APIs for OpenWeatherMap.org
Stars: ✭ 14 (-86%)
Mutual labels:  openweathermap-api, openweathermap, openweathermap-android
SciFi Conky HUD
SciFi theme for Conky
Stars: ✭ 33 (-67%)
Mutual labels:  openweathermap-api, openweathermap
TheWeatherDashboardApp
A small and stylish weather dashboard.
Stars: ✭ 29 (-71%)
Mutual labels:  openweathermap-api, openweathermap
angular-openweather-app
A weather forecast app written in AngularJS
Stars: ✭ 54 (-46%)
Mutual labels:  openweathermap-api, openweathermap
weather-bar-app
Weather Bar lives in your Menu Bar giving you access to beautiful real-time weather conditions and a generous 15-day forecast.
Stars: ✭ 38 (-62%)
Mutual labels:  openweathermap-api, openweathermap
WeatherApp MVI sample
🌸[Functional reactive programming (FRP)] 🍁Simple Android weather forecast application written in Kotlin, using RxKotlin, Retrofit2, Mosby, Room Persistence ❄️MVI Pattern with Mosby Library
Stars: ✭ 106 (+6%)
Mutual labels:  retrofit2
Pursuit-Core-Android
Pursuit Core Android
Stars: ✭ 45 (-55%)
Mutual labels:  retrofit2
wikilight
A lightweight Wikipedia Client
Stars: ✭ 50 (-50%)
Mutual labels:  retrofit2
OkhttpCacheInterceptor
The OkHttpCacheInterceptor 一个OkHttp的网络缓存拦截器,可自定义场景对请求的数据进行缓存
Stars: ✭ 32 (-68%)
Mutual labels:  retrofit2
Instant-Weather
An Android weather application implemented using the MVVM pattern, Retrofit2, Dagger Hilt, LiveData, ViewModel, Coroutines, Room, Navigation Components, Data Binding and some other libraries from the Android Jetpack.
Stars: ✭ 677 (+577%)
Mutual labels:  retrofit2
acuparse
Captures, stores, and displays data from an AcuRite ‎Iris/Atlas weather station and towers via an Access/smartHUB. Uploads data to Weather Underground, CWOP, Weathercloud, PWS Weather, Windy, Windguru, and OpenWeatherMap. *** MIRROR REPO | See: https://gitlab.com/acuparse/acuparse ***
Stars: ✭ 57 (-43%)
Mutual labels:  openweathermap
StatefulLiveData
StatefulLiveData is a lean, yet powerful tool that harnesses the capabilities of LiveData and enhances them, enabling the observer to distinguish between different states the data can be in, such as Success, Loading and Error.
Stars: ✭ 18 (-82%)
Mutual labels:  retrofit2
Dribbble
根据Dribbble 网站开源的API,将世界各大优秀设计师的作品,展示出来,用于学习MD设计和流式编程。项目采用Google设计规范Material Design设计开发,基础架构采用MVP模式进一步解耦, 使用流式编程框架RxJava + RxAndroid ,结合Retrofit客户端库组织网络框架,图片缓存库采用Google。
Stars: ✭ 20 (-80%)
Mutual labels:  retrofit2
NewsPin
News app for android using Kotlin, coroutines, MVP architecture
Stars: ✭ 25 (-75%)
Mutual labels:  retrofit2
opensea
python wrapper for opensea api
Stars: ✭ 38 (-62%)
Mutual labels:  wrapper-library
weather
基于MVP的安卓天气demo
Stars: ✭ 49 (-51%)
Mutual labels:  retrofit2
HotSalesPOS
No description or website provided.
Stars: ✭ 14 (-86%)
Mutual labels:  retrofit2
DailyDoc
Productivity Note App utilizing Jetpack Compose
Stars: ✭ 31 (-69%)
Mutual labels:  retrofit2
react-weather-app
An attempt to make an ultimate weather app. In ReactJS, with React hooks and context.
Stars: ✭ 39 (-61%)
Mutual labels:  openweathermap
MVP Project
mvp 案例
Stars: ✭ 43 (-57%)
Mutual labels:  retrofit2

OpenWeatherMap-Android-Library

You need an API Key to use the OpenWeatherMap API. Head on over to their website if you don't already have one.

Download

Step 1. Add the JitPack repository to your root build.gradle file.

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Step 2 : Download via Gradle:

implementation 'com.github.KwabenBerko:OpenWeatherMap-Android-Library:2.1.0'

Note: Remember to include the INTERNET permission to your manifest file

Usage

Instantiate Class With Your OpenWeatherMap Api Key

OpenWeatherMapHelper helper = new OpenWeatherMapHelper(getString(R.string.OPEN_WEATHER_MAP_API_KEY));

Set your Units (Optional, STANDARD by default)

helper.setUnits(Units.IMPERIAL);
Unit Options:
  1. Units.IMPERIAL (Fahrenheit)

  2. Units.METRIC (Celsius)

Set your Language (ENGLISH by default)

helper.setLanguage(Languages.ENGLISH);

Features

(1) Current Weather

Get current weather by City Name:

 helper.getCurrentWeatherByCityName("Accra", new CurrentWeatherCallback() {
     @Override
     public void onSuccess(CurrentWeather currentWeather) {
         Log.v(TAG, "Coordinates: " + currentWeather.getCoord().getLat() + ", "+currentWeather.getCoord().getLon() +"\n"
                         +"Weather Description: " + currentWeather.getWeather().get(0).getDescription() + "\n"
                         +"Temperature: " + currentWeather.getMain().getTempMax()+"\n"
                         +"Wind Speed: " + currentWeather.getWind().getSpeed() + "\n"
                         +"City, Country: " + currentWeather.getName() + ", " + currentWeather.getSys().getCountry()
         );
     }

     @Override
     public void onFailure(Throwable throwable) {
         Log.v(TAG, throwable.getMessage());
     }
 });

Get current weather by City ID:

 helper.getCurrentWeatherByCityID("524901", new CurrentWeatherCallback() {
     @Override
     public void onSuccess(CurrentWeather currentWeather) {
         Log.v(TAG, "Coordinates: " + currentWeather.getCoord().getLat() + ", "+currentWeather.getCoord().getLon() +"\n"
                         +"Weather Description: " + currentWeather.getWeather().get(0).getDescription() + "\n"
                         +"Temperature: " + currentWeather.getMain().getTempMax()+"\n"
                         +"Wind Speed: " + currentWeather.getWind().getSpeed() + "\n"
                         +"City, Country: " + currentWeather.getName() + ", " + currentWeather.getSys().getCountry()
         );
     }

     @Override
     public void onFailure(Throwable throwable) {
         Log.v(TAG, throwable.getMessage());
     }
 });

Get current weather by Geographic Coordinates:

 helper.getCurrentWeatherByGeoCoordinates(5.6037, 0.1870, new CurrentWeatherCallback() {
     @Override
     public void onSuccess(CurrentWeather currentWeather) {
         Log.v(TAG, "Coordinates: " + currentWeather.getCoord().getLat() + ", "+currentWeather.getCoord().getLon() +"\n"
                         +"Weather Description: " + currentWeather.getWeather().get(0).getDescription() + "\n"
                         +"Temperature: " + currentWeather.getMain().getTempMax()+"\n"
                         +"Wind Speed: " + currentWeather.getWind().getSpeed() + "\n"
                         +"City, Country: " + currentWeather.getName() + ", " + currentWeather.getSys().getCountry()
         );
     }

     @Override
     public void onFailure(Throwable throwable) {
         Log.v(TAG, throwable.getMessage());
     }
 });

Get current weather by Zip Code:

 helper.getCurrentWeatherByZipCode("90003", new CurrentWeatherCallback() {
     @Override
     public void onSuccess(CurrentWeather currentWeather) {
         Log.v(TAG, "Coordinates: " + currentWeather.getCoord().getLat() + ", "+currentWeather.getCoord().getLon() +"\n"
                         +"Weather Description: " + currentWeather.getWeather().get(0).getDescription() + "\n"
                         +"Temperature: " + currentWeather.getMain().getTempMax()+"\n"
                         +"Wind Speed: " + currentWeather.getWind().getSpeed() + "\n"
                         +"City, Country: " + currentWeather.getName() + ", " + currentWeather.getSys().getCountry()
         );
     }

     @Override
     public void onFailure(Throwable throwable) {
         Log.v(TAG, throwable.getMessage());
     }
 });

(2) 5 day / 3 hour forecast

Get three hour forecast by City Name:

 helper.getThreeHourForecastByCityName("Pretoria", new ThreeHourForecastCallback() {
     @Override
     public void onSuccess(ThreeHourForecast threeHourForecast) {
         Log.v(TAG, "City/Country: "+ threeHourForecast.getCity().getName() + "/" + threeHourForecast.getCity().getCountry() +"\n"
                         +"Forecast Array Count: " + threeHourForecast.getCnt() +"\n"
                         //For this example, we are logging details of only the first forecast object in the forecasts array
                         +"First Forecast Date Timestamp: " + threeHourForecast.getList().get(0).getDt() +"\n"
                         +"First Forecast Weather Description: " + threeHourForecast.getList().get(0).getWeather().get(0).getDescription()+ "\n"
                         +"First Forecast Max Temperature: " + threeHourForecast.getList().get(0).getMain().getTempMax()+"\n"
                         +"First Forecast Wind Speed: " + threeHourForecast.getList().get(0).getWind().getSpeed() + "\n"
         );
     }

     @Override
     public void onFailure(Throwable throwable) {
         Log.v(TAG, throwable.getMessage());
     }
 });

Get three hour forecast by City ID:

 helper.getThreeHourForecastByCityID("524901", new ThreeHourForecastCallback() {
     @Override
     public void onSuccess(ThreeHourForecast threeHourForecast) {
         Log.v(TAG, "City/Country: "+ threeHourForecast.getCity().getName() + "/" + threeHourForecast.getCity().getCountry() +"\n"
                         +"Forecast Array Count: " + threeHourForecast.getCnt() +"\n"
                         //For this example, we are logging details of only the first forecast object in the forecasts array
                         +"First Forecast Date Timestamp: " + threeHourForecast.getList().get(0).getDt() +"\n"
                         +"First Forecast Weather Description: " + threeHourForecast.getList().get(0).getWeather().get(0).getDescription()+ "\n"
                         +"First Forecast Max Temperature: " + threeHourForecast.getList().get(0).getMain().getTempMax()+"\n"
                         +"First Forecast Wind Speed: " + threeHourForecast.getList().get(0).getWind().getSpeed() + "\n"
         );
     }

     @Override
     public void onFailure(Throwable throwable) {
         Log.v(TAG, throwable.getMessage());
     }
 });

Get three hour forecast by Geographic Coordinates:

 helper.getThreeHourForecastByGeoCoordinates(6.5244,3.3792, new ThreeHourForecastCallback() {
     @Override
     public void onSuccess(ThreeHourForecast threeHourForecast) {
         Log.v(TAG, "City/Country: "+ threeHourForecast.getCity().getName() + "/" + threeHourForecast.getCity().getCountry() +"\n"
                         +"Forecast Array Count: " + threeHourForecast.getCnt() +"\n"
                         //For this example, we are logging details of only the first forecast object in the forecasts array
                         +"First Forecast Date Timestamp: " + threeHourForecast.getList().get(0).getDt() +"\n"
                         +"First Forecast Weather Description: " + threeHourForecast.getList().get(0).getWeather().get(0).getDescription()+ "\n"
                         +"First Forecast Max Temperature: " + threeHourForecast.getList().get(0).getMain().getTempMax()+"\n"
                         +"First Forecast Wind Speed: " + threeHourForecast.getList().get(0).getWind().getSpeed() + "\n"
         );
     }

     @Override
     public void onFailure(Throwable throwable) {
         Log.v(TAG, throwable.getMessage());
     }
 });

Get three hour forecast by Zip Code:

 helper.getThreeHourForecastByZipCode("94040", new ThreeHourForecastCallback() {
     @Override
     public void onSuccess(ThreeHourForecast threeHourForecast) {
         Log.v(TAG, "City/Country: "+ threeHourForecast.getCity().getName() + "/" + threeHourForecast.getCity().getCountry() +"\n"
                         +"Forecast Array Count: " + threeHourForecast.getCnt() +"\n"
                         //For this example, we are logging details of only the first forecast object in the forecasts array
                         +"First Forecast Date Timestamp: " + threeHourForecast.getList().get(0).getDt() +"\n"
                         +"First Forecast Weather Description: " + threeHourForecast.getList().get(0).getWeather().get(0).getDescription()+ "\n"
                         +"First Forecast Max Temperature: " + threeHourForecast.getList().get(0).getMain().getTempMax()+"\n"
                         +"First Forecast Wind Speed: " + threeHourForecast.getList().get(0).getWind().getSpeed() + "\n"
         );
     }

     @Override
     public void onFailure(Throwable throwable) {
         Log.v(TAG, throwable.getMessage());
     }
 });

Upcoming Features

  1. Hourly Forecast 4 days
  2. Daily Forecast 16 days
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].