Android Client Wrapper for Dark Sky Weather API
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
darkskyandroidlib
gradle/wrapper
.gitignore
.travis.yml
build.gradle
gradle.properties
gradlew
gradlew.bat
readme.md
settings.gradle

readme.md

Dark Sky API Android Wrapper

Build Status

#####Install

  • Add the following to your build.gradle:
repositories {
	    maven { url "https://jitpack.io" }
}

dependencies {
	    compile 'com.github.johnhiott:DarkSkyApi:v0.1.5'
}

#####Get API ready

@Override
public void onCreate() {
    super.onCreate();
    ForecastApi.create("replaceWithYourApiKey");
}

#####Making a request

RequestBuilder weather = new RequestBuilder();

Request request = new Request();
request.setLat("32.00");
request.setLng("-81.00");
request.setUnits(Request.Units.US);
request.setLanguage(Request.Language.PIG_LATIN);
request.addExcludeBlock(Request.Block.CURRENTLY);

weather.getWeather(request, new Callback<WeatherResponse>() {
    @Override
    public void success(WeatherResponse weatherResponse, Response response) {
        //Do something
    }

    @Override
    public void failure(RetrofitError retrofitError) {
        Log.d(TAG, "Error while calling: " + retrofitError.getUrl());
    }
});

Original API docs here