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.
  • It was a sample that was removed from the SDK. The weather service that was used started requiring a developer key which isn't supposed to be shared, so the sample couldn't work straight out of the box.

    If you have the Eclipse plugin, you should be able to download old SDK versions (ConnectIQ > Open SDK Manager). If you don't see any versions listed, be sure to set the SDK download directory. The 1.2.0 SDK should have it.
  • If you get an old version from a prior SDK, remember that you'll need to get an API KEY from Open Weather, and change the makeJsonRequest() in the sample to supply it.

    you need to do this to the request:

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


    To get the key, see http://openweathermap.org/appid

    One other thing, is the sample starts out looking for GPS. To do this in the simulator, Click on "Simulation", then "Fit Data", them "Simulate Data". You'll get GPS locations in Kansas.
  • Former Member
    Former Member over 9 years ago
    If you get an old version from a prior SDK, remember that you'll need to get an API KEY from Open Weather, and change the makeJsonRequest() in the sample to supply it.

    you need to do this to the request:

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


    To get the key, see http://openweathermap.org/appid

    One other thing, is the sample starts out looking for GPS. To do this in the simulator, Click on "Simulation", then "Fit Data", them "Simulate Data". You'll get GPS locations in Kansas.


    Worked like a charm. Thank you very much.
  • Former Member
    Former Member over 9 years ago
    One newbie question I have.
    How do you 'debug' an app in this environment? Can I configure Eclipse on some way to do that?

    For example, if I want to see the answer and the JSON data received, how can I stop de execution at that point to check the response?
  • There are no breakpoints with Eclipse and monkey c.

    If you what to see the data, in onReceive(), add

    Sys.println(data);

    You'll see a dictionary of the returned data.
  • Former Member
    Former Member over 9 years ago
    There are no breakpoints with Eclipse and monkey c.

    If you what to see the data, in onReceive(), add

    Sys.println(data);

    You'll see a dictionary of the returned data.


    Thank you again for your fast answer.

    Traces are poor man's debug mode :-(

    I figured out that one, but expected to have some more 'elegant' solution...

    This Garmin environment is a bit rude, isn't it?
  • Using Sys.println() isn't ideal, but it works. And with it, you can get info when sideloading to a watch too.

    The side load of the .prg goes in \garmin\apps on the watch, and if you create a file called <your progam name>.txt in \garmin\apps\logs, you'll get the Sys.println() data written to that file. (abc.prg would use abc.txt, for example)
  • Former Member
    Former Member over 9 years ago
    This Garmin environment is a bit rude, isn't it?


    LOL - quite the understatement. It's rather stunning given that Garmin has such a long history of producing solid technology for critical tasks (e.g.: glass cockpits, all variety of marine navigation and instrumentation), and then they come up with CIQ and call it a commercial product.... Well, at least the hardware looks nice.
  • Former Member
    Former Member over 9 years ago
    error trying to get the forecast

    Hello,

    I changed the query to get the weather forecast instead of the current weather data, but I'm getting an error.

    Changed:

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


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


    But all I get is a responsecode=0 and NULL data.

    If I manually access the URL and pass the parameters in the URL, it works fine. How can I see what's going on?
  • 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