gelin / weather-notification

An utility which displays the weather in the Android notification bar
GNU General Public License v3.0
26 stars 11 forks source link

Fetch 5 days of forecast data #57

Closed smartfoss closed 4 years ago

smartfoss commented 4 years ago

First: sorry - i opened Issue #57 on bitbucket before i saw, that you moved to github.

I use Gadgetbridge with Weather-Notification for my Amazfit Smartwatch. The Smartwatch shows weather for the next 5 days. Weather-Notification requests via Openweathermap-API the data for 4 days. As a result, on the smartwatch the 5th day is shown as unknown or "?".

It would be great if this small change could be implemented.

smartfoss commented 4 years ago

As a quick test, i applied some changes locally an did a gradlew assembleDebug:

vi core/src/main/java/ru/gelin/android/weather/openweathermap/OpenWeatherMapWeather.java 137 for (int i = 1; i < 5 && i < list.length(); i++) {

vi libs/libweather/src/main/java/ru/gelin/android/weather/notification/WeatherStorage.java 130 for (; i < 5; i++) {

vi core/src/main/java/ru/gelin/android/weather/openweathermap/OpenWeatherMapSource.java 105 URLEncoder.encode(key.getKey(), "UTF-8") + "&cnt=5&id=" + String.valueOf(cityId);

For the Debug-build i also had to change the API-URLs to https:...

gelin commented 4 years ago

In v0.3.11 8 days forecast is fetched.