Widget: Weather

Former Member
Former Member
https://apps.garmin.com/en-US/apps/7a83e98d-6df2-4920-a90c-9da7275c41f9


Quickly check the weather before you go out for a run. Your last known GPS location is used when you are indoors. This widget requires that Garmin Connect Mobile is running on your cell phone so that it can communicate with the internet. This apps uses the System-Units-Distance setting to determine whether to show statute (Fahrenheit/mph) or metric settings(Celsius/kph). You must be running the latest version of the device software that supports widgets.
  • the standard widget (vivoactive) also seems to get data only from the nearest "big" weather station, is often old, and in my case, the airport in the other side of the mountain from where I live, which is often different. I AM working on a widget that gets the current data from a WeatherUnderground weather station (Wunderground is part of the weather channel) near you, and it pretty much works, but there is no way right now where a user can configure which station, as CIQ will have to change for that.
  • Former Member
    Former Member over 10 years ago
    The free version of weather underground will only give you 500 calls per day and 10 per hour. You will have to pay at least $20 per month for 5000 calls per day and 100 calls per minute. And it's pretty much impossible to recover the $20 per month when you are giving away an app. The weather service that I'm using has more than 40,000 weather stations.
  • 500 calls, with a free API key is more than enough for most users, and each can get their own key and set that along with the WU station ID. (when available)

    The makeJsonRequest() can be slow on the VA, regardless of which site you are getting CURRENT data from, and with the 10 second "revert" timer for widgets on the vivoactive, THAT is also an issue, BTW. Have you tested your widget on a vivoactive, vs other devices that have a 60 second revert timer? I'm betting you just have a "pretty" version of the weather widget included with the SDK, getting data from the same site! Your'e using "api.openweathermap.org/data/2.5/weather", correct?

    IMHO, it's not just "make it pretty", as the SDK samples, are just the basics, and don't consider much, and for something like this, you really need to understand what it happening to GET that data! I saw this in the App store and all I saw was a "Pretty" version of the SDK sample....

    Consider also checking things like phioneConnected before you even try to get new data....
  • Former Member
    Former Member over 10 years ago
    Yes I have thought about making each user sign up and get their own key and using one of the other services...but that isn't very user friendly.
    Yes I have tested it with the vivo active and it will work with that, but you are right it will sometimes timeout before data can be returned.
    Yes it uses the openweather data, that is the only weather site I have found that I don't have to pay for or make every user sign up for their own key.

    Jim, have you actually used the app? It is not simply a "pretty" version of the sample. It does check that the phone is connected before it tries to get any data. It will give you a message saying that you need to start up Garmin Connect Mobile if the phone isn't connected. It will also use the last fix of the GPS to get the data instead of waiting for a GPS signal (which allows the widget to work while you are inside and can't get a GPS signal), it will then refresh the weather if it can get a GPS fix and updated weather while the widget is running. It also caches data for 10 minutes so that if you run the widget multiple times in a row it gives you a much quicker response. It uses multiple pieces of data that was not included in the sample. It also reads the system settings so it knows if it should display the information in metric vs standard US. The only thing this app has in common with the sample is they both get data from openweather.

    I'm not sure why you are being so negative. I would suggest actually using the app and comparing it to what the sample does.

    Please let me know if you have any suggestions or questions.
  • So, a "pretty" version of the SDK Sample. That's what I thought. With the vivoactive, you probably won't get data in time to avoid the revert timeout (with time to see it!) about 1/2 of the time from my own experience. Hope you can respond to users if this is in the app store, as some might be confused!
  • Former Member
    Former Member over 10 years ago
    Jim, like I mentioned above it is not just a "pretty" version of the sample. Also as I mentioned above it will cache the data for 10 minutes after it loads it. So if you don't see the result the first time you can quickly pull it back up without having to make an internet call. The only thing it has in common with the sample is the website that it gets it data from.

    Unfortunately I can not control the revert timeout and I can not control the data transfer speed of BTLE.

    Please try the app out and then let me know if you have any more questions or suggestions.
  • How does it "cache" it? If the widget has reverted, it's not running, and the data is discarded...

    And it's a widget, not an app. They are VERY different!
  • Former Member
    Former Member over 10 years ago
    How does it "cache" it? If the widget has reverted, it's not running, and the data is discarded...

    And it's a widget, not an app. They are VERY different!


    Jim applications and widgets can both read and write data to the watch. You can then use this data when your application or widget starts up. Let me know if you need some sample code and I can provide it for you.
    Please try the widget out and let me know if you have any other questions/concerns.
  • Former Member
    Former Member over 10 years ago
    Would it be possible to add the weather stations name to the display so that you can see from where it got its data?
  • Former Member
    Former Member over 10 years ago
    Would it be possible to add the weather stations name to the display so that you can see from where it got its data?

    They do not provide the weather station name, but they do have the city name. But with the limited screen real estate I didn't feel the city name was that useful so I don't display it.