Coder Social home page Coder Social logo

forecast-android's Introduction

forecast-android

An Android library to integrate the Forecast API into your application

Contents

Getting Started

For a more in depth look at the usage, refer to the example Android app.

Gradle

Specify the dependency in your build.gradle file (make sure jcenter() is included as a repository)

compile 'android.zetterstrom.com.forecast:forecast:1.2.1'

Forecast API Registration

In order to use the Forecast API, you will need to register as developer with them, and obtain an API key

Reference

Configure the library

Before you can make a request with the Forecast library, you must configure it.

ForecastConfiguration configuration =
    new ForecastConfiguration.Builder(API_KEY)
        .setCacheDirectory(getCacheDir())
        .build();
ForecastClient.create(configuration);

Make a forecast request

double latitude = 40.2712;
double longitude = -74.7829;
ForecastClient.getInstance()
                    .getForecast(latitude, longitude, new Callback<Forecast>() {
                        @Override
                        public void onResponse(Call<Forecast> forecastCall, Response<Forecast> response) {
                            if (response.isSuccess()) {
                                Forecast forecast = response.body();
                            }
                        }

                        @Override
                        public void onFailure(Call<Forecast> forecastCall, Throwable t) {

                        }
                    });

forecast-android's People

Contributors

kevinzetterstrom avatar

Watchers

James Cloos avatar

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.