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.