weather sample app?

Former Member
Former Member
I've seen in several posts references to a 'Weather Sample App'.
However, I couldn't find it anywhere.
Can anybody please provide me with the directions to have that sample app?
Thank you in advance.
  • Former Member
    Former Member over 9 years ago
    I'm not certain, but I'm willing to bet that the query is returning to many results and the device can't process them all. Try limiting the result set...

    Comm.makeJsonRequest("api.openweathermap.org/.../forecast",
    {"cnt"=>3, "lat"=>latLon[0].toFloat(), "lon"=>latLon[1].toFloat(),"appid"=>"your api key here"}, {}, method(:onReceive));


    Travis


    Hello, introducing the cnt parameter now gives some answer, but simulator breaks and exits.

    {message=>0.003700, city=>{sys=>{population=>0}, population=>0, id=>4276614, coord=>{lat=>38.881401, lon=>-94.819130}, name=>Olathe, country=>US}, cod=>200, cnt=>3, list=>[{clouds=>{all=>88}, main=>{pressure=>1002.690002, grnd_level=>1002.690002, temp_max=>269.477997, sea_level=>1039.339966, temp_kf=>-2.470000, temp_min=>267.010010, temp=>267.010010, humidity=>86}, weather=>[{main=>Snow, id=>600, description=>light snow, icon=>13n}], wind=>{deg=>105.000999, speed=>4.520000}, dt=>1453248000, snow=>{3h=>1.344000}, sys=>{pod=>n}, dt_txt=>2016-01-20 00:00:00}, {clouds=>{all=>88}, main=>{pressure=>1003.130005, grnd_level=>1003.130005, temp_max=>268.666992, sea_level=>1040.040039, temp_kf=>-2.340000, temp_min=>266.329987, temp=>266.329987, humidity=>92}, weather=>[{main=>Snow, id=>600, description=>light snow, icon=>13n}], wind=>{deg=>94.001503, speed=>3.260000}, dt=>1453258800, snow=>{3h=>0.299750}, sys=>{pod=>n}, dt_txt=>2016-01-20 03:00:00}, {clouds=>{all=>36}, main=>{pressure=>1003, grnd_level=>1003, temp_max=>267.484985, sea_level=>1040.119995, temp_kf=>-2.210000, temp_min=>265.279999, temp=>265.279999, humidity=>92}, weather=>[{main=>Clear, id=>800, description=>sky is clear, icon=>01n}], wind=>{deg=>62.000702, speed=>2.760000}, dt=>1453269600, snow=>{3h=>0.021250}, sys=>{pod=>n}, dt_txt=>2016-01-20 06:00:00}]}
    Failed invoking <symbol>
    UnexpectedTypeException: Expected Object/Array/Dictionary, given null
    onReceive in C:\connectiq-sdk-win-1.2.2\samples\Weather\source\WeatherView.mc:63
    Unhandled Exception
    failed inside handle_json_callback
    Connection Finished
    Closing shell and port


    Thank you anyhow.
  • Former Member
    Former Member over 9 years ago
    Well. That's it. I give up.

    just in case the answer from openweathermaps was too long, or had too complex data (??), I made a php to get the response from openweathermaps and strip it down to the most basic JSON structure for the Garmin App. Same error:
    onReceive
    200
    {lat=>1.12345678, appid=>d3393e19d1c212106459ca0f8e89882c, lon=>1.12345678}
    Failed invoking <symbol>
    UnexpectedTypeException: Expected Object/Array/Dictionary, given null
    onReceive in C:\proyectos\connectiq-sdk-win-1.2.2\samples\Weather\source\WeatherView.mc:72
    Unhandled Exception
    failed inside handle_json_callback
    Connection Finished
    Closing shell and port


    I cannot develop anything if comms are not reliable. As I was doing this weather app just for fun (and because I wanted one), after loosing a couple of days strugling to develop this app I think I will pass and enjoy the Fenix 3 as is.

    Thank you all for your support.