An Android library to integrate the Forecast API into your application
For a more in depth look at the usage, refer to the example Android app.
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'
In order to use the Forecast API, you will need to register as developer with them, and obtain an API key
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);
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) {
}
});