Data from a web service in a datafield, or access to a widget from an activity app

Former Member
Former Member
Hi,

I have written a widget (and an unpublished app) that gets some data from a web service using makeJsonResuest() which is part of the Communications module. I have a couple of people asking whether it is possible to include the key number in a data field. This is so that they can show their blood sugar in something like the run app.

So how do I do this?

Please don't answer "Communications module is not available in datafields to conserve battery", I know that.

I am pretty sure that it is not possible to pass data between widgets and data fields or between applications, but if anyone knows of a way to do this, please say how.

The current behaviour of my widget is open, make a call to the web service, display the data, close (because auto closing is what Garmin make my Vivoactive do for widgets)

Based on the assumptions
There is no conventional approach to be taken to get data from my web service into a data field
That I would be a wasting my time developing a run app of my own that accesses the data.
That updating the data from my web service will have a drain on the battery but my users will accept the cost for the benefit.

Does anyone have any ideas on how to solve the problem.

I have the following ideas on ingredients to a possible solution and want to know whether any are viable:
1. Create a timer in my widget that keeps it alive and refreshing periodically so that I can keep fetching the data. I only need to make a call every five minutes, as that is the frequency at which data is updated. I think that this is a prerequisite for updating a data field.
2. Keep my widget running whilst an app is running. It seems as though the step counter runs on my Vivoactive still functions and it looks like a widget.
3. Create my own activityinfo entry or some other system type field that I can write data to if from my widget so that a datafield can use it?
4. Update an existing activity info attribute that I have chosen to hijack such as swolf, because my users won't be swimming
5. Add my widget to the pool that is available when running another app, so that a user can at least switch to it whilst exercising.
6 Override the standard garmin exercise apps so that I can leave them fully functional but have the extra bonus of being able to add my own custom code
7. Create an add in so that the standard apps can include a widget or sub-app similar to the inclusion of custom data fields.
8. Push data from my api to the watch using an app that sends a notification that feeds a data field.

I fully expect the answers to be "No, but nice try".

I whilst I am thinking of useful things, do you think that it is possible to read a json file from and android phone running garmin connect mobile? If you can that would mean that I might be able to run the app in "camping mode" and provide data without an internet connection. But that is another issue.

It would be great if Garmin could allow communications in data fields and just provide a warning of the impact on battery life. If I choose to do something silly like find out what my blood sugar is whilst exercising I will take the battery life hit. I suspect that app stores self govern and therefore if people write data fields that cause poor performance on users watches don't have their apps downloaded and get poor reviews, so allowing it would make it better for developers. Oh yes, and watch faces too?

Any thoughts on how to get data from a webservice into a data field or another app would be much appreciated.

Thanks,
R.
  • It does seem crazy to be required to re-invent the entire wheel just to add some relatively simple functionality. But both options should be there. Rolling your own from scratch or being able to leverage what Garmin has already produced.

    It is a shame that they have put so many limitations on the simple extensions. It will keep a lot of interesting ideas from being developed. I'd much rather spend my time adding functionality than first redoing what Garmin has done. Seems like every time I turn a corner I run into a new unexpected limitation.

    Hopefully with time, communication, positioning, and sensors (like the Tempe) will be added to fields. Plus Widgets that can stay active for more than a few seconds, or full communication added to faces.
  • Former Member
    Former Member over 9 years ago
    Communications for data fields

    It does seem crazy to be required to re-invent the entire wheel just to add some relatively simple functionality. But both options should be there. Rolling your own from scratch or being able to leverage what Garmin has already produced.

    It is a shame that they have put so many limitations on the simple extensions. It will keep a lot of interesting ideas from being developed. I'd much rather spend my time adding functionality than first redoing what Garmin has done. Seems like every time I turn a corner I run into a new unexpected limitation.

    Hopefully with time, communication, positioning, and sensors (like the Tempe) will be added to fields. Plus Widgets that can stay active for more than a few seconds, or full communication added to faces.


    I agree with you there EKUTTER, thank you I'm glad I am not alone. Now that Christmas has passed, people have new toys, and guess what the number one request for my app is? "I want to be able to see this data whilst exercising"

    So assuming that Garmin are not going to allow communications in data fields. (Boo hiss.)

    How do I get my widget visible in the carousel when running an app? What is the magic setting?

    Does anyone (such as Garmin) have an exercise app that they have Open Sourced so that I can add the functionality to it?

    Any other ideas?

    R.
  • I agree with you there EKUTTER, thank you I'm glad I am not alone. Now that Christmas has passed, people have new toys, and guess what the number one request for my app is? "I want to be able to see this data whilst exercising"

    So assuming that Garmin are not going to allow communications in data fields. (Boo hiss.)

    How do I get my widget visible in the carousel when running an app? What is the magic setting?

    Does anyone (such as Garmin) have an exercise app that they have Open Sourced so that I can add the functionality to it?

    Any other ideas?

    R.


    1) CIQ widgets are not available when running an app, even on devices that give you access to the widget loop, like the vivoactive.
    2) as far as a CIQ app, the "RecodingSample" in the SDK does the basics of recording. When it comes to the display of data, most of it is simple to do - like speed and distance for example. You get a number in metric, convert it if needed, and format it for display. I have a full blown indoor walking app that's less than 18k, for example, with 4 screens of data (I have watchfaces larger than that). You'd have to handle things like laps within the app, but when it comes down to deciding to mark a lap, it's just a simple call to do it.
  • It is a shame that they have put so many limitations on the simple extensions.

    Hopefully with time, communication, positioning, and sensors (like the Tempe) will be added to fields. Plus Widgets that can stay active for more than a few seconds, or full communication added to faces.


    Don't forget that for the success of any tech gadget / product, it is a fine balancing act by these companies to decide what to allow or not.
    This can be compared to iOS' sandboxed environment for example.

    Although we as developers often feel frustrated by the lack of certain features, always remember that there is a bigger picture. :D
  • Former Member
    Former Member over 7 years ago
    Hi Phimby -

    I came across your thread from a few years ago asking about a way to get data from a web service into a data field. Interestingly, I was not only trying to find a way to do that, but I want to do it with the exact same data you did.

    I am a T1D cyclist and very active participant in the JDRF Ride to Cure program. Even though I have my phone which acts as my Dexcom receiver on a mount on my stem and an Apple watch which shows my number on the screen, neither come close to what having it show on my always on Garmin 820 screen would do.

    Did you ever figure out a way to do this? I assume you were retrieving your JSON data from Nightscout. I would love to see if you have been able to successfully accomplish anything in this area.
  • This is indeed a very old thread, and since it was active, things have changed. You can now have a background process in a data filed that does comm. You're limited to only requesting data every 5 minutes at most, but I've pulled data off the internet in this way.

    With an edge 820, you won't be able to access a companion app on your phone though.

    Here's a blog post about backgrounding, and in it, I link back to a thread in the forums that contains a sample watchface to show the basics of backgrounding.

    Here's a link to the forum thread
  • Former Member
    Former Member over 7 years ago

    Thanks Jim. The data I want only updates every five minutes, so that limitation will not be a problem. I'll check out your post!
  • This may be a solution for you; We just released a service that enables secure communication between apps. Shared storage can be emulated using this.  You can learn more at https://dacrosse.com