All Projects → CodelightStudios → Weather-Downloader

CodelightStudios / Weather-Downloader

Licence: MIT license
Get the weather data you need right into your android app in an easy and efficient way.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Weather-Downloader

weathercan
R package for downloading weather data from Environment and Climate Change Canada
Stars: ✭ 83 (+219.23%)
Mutual labels:  weather-data, weather-downloader
homepage
Custom Start/home page (multi LIVE search) with live animated weather and news ticker - written in HTML/JS. Minimal, self-hosted, and dope.
Stars: ✭ 35 (+34.62%)
Mutual labels:  weather-data
angular-openweather-app
A weather forecast app written in AngularJS
Stars: ✭ 54 (+107.69%)
Mutual labels:  weather-data
nasapower
API Client for NASA POWER Global Meteorology, Surface Solar Energy and Climatology in R
Stars: ✭ 79 (+203.85%)
Mutual labels:  weather-data
owmr
An R Interface to OpenWeatherMap
Stars: ✭ 24 (-7.69%)
Mutual labels:  weather-data
get-weather-data
Get weather data for a list of zip codes for a range of dates
Stars: ✭ 32 (+23.08%)
Mutual labels:  weather-data
inmetr
DEPRECATED A R-package to Import Historical Data from Brazilian Meteorological Stations
Stars: ✭ 18 (-30.77%)
Mutual labels:  weather-data
dwdweather2
Python client to access weather data from Deutscher Wetterdienst (DWD), the federal meteorological service in Germany.
Stars: ✭ 68 (+161.54%)
Mutual labels:  weather-data
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 (+119.23%)
Mutual labels:  weather-data
api
Community discussion and documentation for the NWS API
Stars: ✭ 168 (+546.15%)
Mutual labels:  weather-data
aprs-weather-submit
Manually submit weather station information to the APRS-IS network.
Stars: ✭ 17 (-34.62%)
Mutual labels:  weather-data
OWM-JAPIs
Java APIs for OpenWeatherMap.org
Stars: ✭ 14 (-46.15%)
Mutual labels:  weather-data

Weather-Downloader Android Arsenal Download MethodCount

Want to show the weather information in your app, here is a simple and efficient solution for you. Now show the weather information you need in your app without deviating away from your app's core idea. This is a helper library to get basic weather information into your app (not into a weather app of course). It uses the openweathermap api to get the weather data. Please note that this is still in beta phase and is limited to get the current weather conditions only. Forecast and Historical data will be added in future releases.

Include in your project

Using Gradle

Add this in dependencies of your app's build.gradle file.

compile 'codelight.studios.android:weather-downloader:0.2'

How to use

1. Implement the WeatherDataDownloadListener in your Activity

WeatherDataDownloadListener implements the callback functions to be called after the weather info is loaded.

    
    public class MainActivity extends AppCompatActivity implements WeatherDownloader.WeatherDataDownloadListener {
    
        ...
        
        @Override
        public void onWeatherDownloadComplete(WeatherData data, WeatherDownloader.Mode mode) {
            
        }
    
        @Override
        public void onWeatherDownloadFailed(Exception e) {
            
        }
    }

2. Invoke the getCurrentWeatherData to get the current weather conditions

Invoke the getCurrentWeatherData method by passing your Api Key and the Query (location name/zipcode/id/coordinates) strings.

    //Get data by city name
    WeatherDownloader downloader = new WeatherDownloader(MainActivity.this, WeatherDownloader.Mode.CITYNAME);
    downloader.getCurrentWeatherData(getResources().getString(R.string.weather_api_key), locationQuery);
    
    //Get data by city ID
    WeatherDownloader downloader = new WeatherDownloader(MainActivity.this, WeatherDownloader.Mode.CITYID);
    downloader.getCurrentWeatherData(getResources().getString(R.string.weather_api_key), cityIdQuery);
    
    //Get data by zip code
    WeatherDownloader downloader = new WeatherDownloader(MainActivity.this, WeatherDownloader.Mode.ZIPCODE);
    downloader.getCurrentWeatherData(getResources().getString(R.string.weather_api_key), zipCodeQuery);
    
    //Get data by coordinates.
    //In this method, the coordinatesQuery should be in the form of latitude:longitude format only.
    WeatherDownloader downloader = new WeatherDownloader(MainActivity.this, WeatherDownloader.Mode.COORDINATES);
    downloader.getCurrentWeatherData(getResources().getString(R.string.weather_api_key), coordinatesQuery);
    

That's it! Once the weather is downloaded in the background thread, you will be notified via the above mentioned onWeatherDownloadComplete or onWeatherDownloadFailed listeners.

Other features

By default the weather data is downloaded in KELVIN units. You can easily convert it into CELSIUS or FAHRENHEIT by using WeatherUnits class. For example, take a look into the sample app in repo.

    @Override
    public void onWeatherDownloadComplete(WeatherData data, WeatherDownloader.Mode mode) {
        if (mode == WeatherDownloader.Mode.CITYNAME) {
            cityNameTextView.
                    setText(String.format("%.2f", WeatherUnits.convertToCelsius(data.getMain().getTemp())));
        } else if (mode == WeatherDownloader.Mode.CITYID) {
            cityIdProgress.setVisibility(View.GONE);
            cityIdTextView.
                    setText(String.format("%.2f", WeatherUnits.convertToFahrenheit(data.getMain().getTemp())));
        }
    }

Contribution

I would love to welcome everyone of you to contribute to this project and make it better. Currently we are focusing on the current weather data only, but other forecast and historical data features would be a great addition. Encounter any issue? Don't hesitate to open an issue.

Convention I would like to follow: Master branch would be the development branch. So feel free to fork from the Master branch. Release branch will be merged with master branch after every major release.

Our other libraries

Android Smart Login library

An easy and efficient way to add login functionality into your app.

License

The MIT License (MIT)

Copyright (c) 2017 Codelight Studios

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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].