Giter Club home page Giter Club logo

easyweather's Introduction

hero

Easy and quick weather fetching from OpenWeatherMap API for Android.


Specs

Twitter

Featured in

Concept Art

Concept Art

Screenshot

Screenshot

Integration


Add the JitPack repository to your build file, add it in your root build.gradle at the end of repositories:

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
  • Using EasyWeather is as simple as adding it in dependencies of your build.gradle:
dependencies {
	        compile 'com.github.code-crusher:EasyWeather:v1.2'
	}

Usage

First you would need API_KEY from OpenWeatherMap and place it in your build.gradle

buildTypes.each {
        it.buildConfigField 'String', 'OWM_API_KEY', "\"API_KEY\""
    }

First create WeatherMap object:

 WeatherMap weatherMap = new WeatherMap(this, OWM_API_KEY);

To get Current Weather use this in Activity:

By City Name:

weatherMap.getCityWeather(city, new WeatherCallback() {
            @Override
            public void success(WeatherResponseModel response) {
                Weather weather[] = response.getWeather();
                String weatherMain = weather[0].getMain();
            }

To get temperature in specific units you can use:

Double temperature = TempUnitConverter.convertToCelsius(response.getMain().getTemp());

To get other details you can use:

String location = response.getName();
String humidity= response.getMain().getHumidity();
String pressure = response.getMain().getPressure();
String windSpeed = response.getWind().getSpeed();
String iconLink = weather[0].getIconLink();

By Location Coordinates:

weatherMap.getLocationWeather(latitude, longitude, new WeatherCallback() {
            @Override
            public void success(WeatherResponseModel response) {
                
            }

            @Override
            public void failure(String message) {

            }
        });

To get Forecast use this in Activity also you need specify index to get the specific hour of 3 hour Forecast:

By City Name:

weatherMap.getCityForecast(city, new ForecastCallback() {
            @Override
            public void success(ForecastResponseModel response) {
                Weather weather[] = response.getList()[index].getWeather();
            }

            @Override
            public void failure(String message) {

            }
        });

By Location Coordinates:

weatherMap.getLocationForecast(latitude, longitude, new ForecastCallback() {
            @Override
            public void success(ForecastResponseModel response) {
                
            }

            @Override
            public void failure(String message) {

            }
        });
Variable Type
city String
index int
latitude String
longitude String

Issues

Feel free to submit issues and enhancement requests.

Contributing

I would love to welcome contributions and support from other developers. Please refer to each project's style guidelines and guidelines for submitting patches and additions. In general, i follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub.
  2. Clone the project to your own machine.
  3. Commit changes to development branch.
  4. Push your work back up to your fork.
  5. Submit a Pull request so that i can review your changes NOTE: Be sure to merge the latest from "upstream" before making a pull request!

License

Copyright 2016 Vatsal Bajpai

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.

easyweather's People

Contributors

code-crusher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easyweather's Issues

Rain: null

Hello, experiencing Rain being "null" for just about every city I try to pass weatherMap for getCityWeather(...)

resolved

failed to resolved ,when i can gradle build

json parse error

java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 377 path $.rain

"rain" should be an object, not a string

response.getWeather() = null on Release application

Hello,

Everything is working fine on debug, but when i generate signed apk, all the values are null on the object response ( in the function public void success(WeatherResponseModel response))

i check the town and the api code, all is correct ...

Thanks in advance.

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.