survivingwithandroid / WeatherLib

Android Weather Library: android weather lib to develop weather based app fast and easily
http://survivingwithandroid.github.io/WeatherLib/
640 stars 170 forks source link

No value for ground level, my app is crashing ! #28

Closed fabreax closed 9 years ago

fabreax commented 9 years ago

Hi,

My app is crashing in production : org.json.JSONException: No value for grnd_level org.json.JSONObject.get(JSONObject.java:389) org.json.JSONObject.getDouble(JSONObject.java:444) com.survivingwithandroid.weather.lib.provider.openweathermap.OpenweathermapProvider.getFloat(OpenweathermapProvider.java:514) com.survivingwithandroid.weather.lib.provider.openweathermap.OpenweathermapProvider.getCurrentCondition(OpenweathermapProvider.java:126) com.survivingwithandroid.weather.lib.client.okhttp.WeatherDefaultClient$4.onResponse(WeatherDefaultClient.java:380) com.squareup.okhttp.Call$AsyncCall.execute(Call.java:170) com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) java.lang.Thread.run(Thread.java:818)

I don't know why but OpenWeatherLib does not always provide ground_pressure and sea_pressure. For instance : http://api.openweathermap.org/data/2.5/weather?mode=json&lat=48.7563952&lon=2.3055305&units=metric&lang=en http://api.openweathermap.org/data/2.5/weather?mode=json&lat=43.7563952&lon=2.3055305&units=metric&lang=en

survivingwithandroid commented 9 years ago

I fix it in a day

fabreax commented 9 years ago

Thank you so much ! Please tell me when it will be available.

survivingwithandroid commented 9 years ago

+Francesco Azzola OK. And unfortunately, the openweathermap changed their api, they did not supply sea_level and grnd_level again for normal user, so the OpenweathermapProvider.java needs some changed when parses response JSON file. You can check this. Hope this info is useful.

fabreax commented 9 years ago

Thank you. OpenWeatherMap has changed the API without telling us anything ? Where have you seen the modification ? http://openweathermap.org/weather-data#current still have sea_level and grnd_level

HugoGresse commented 9 years ago

@survivingwithandroid why don't you use Gson or jackson for parsing ? Also, I have issue, for example in Punta Cana, there is no humidity and OpenWeatherMap fail to get it, which result in do Weather at all.

survivingwithandroid commented 9 years ago

Release 1.5.9 just published solves this problem.