Hello, I am relatively new to Fitbit and am building an app for research purposes. I want to develop an app that records GPS coordinates at a fixed interval (10 minutes). I got the app working on the Fitbit simulator but am having trouble on the actual device (Fitbit Sense). Do I need to code the app to send the data somewhere, perhaps using the fetch function? And would I also need to use a companion in any way? Thanks in advance for the help!
I would just want the data to be saved in their Fitbit profile to be downloaded via CSV file. Similar to what you can do with the preprogrammed apps.
Best AnswerOh, that's different, and would be more difficult or impossible. Your clockface/app would need to send its data from companion to Web API using fetch(), and there's a built-in component to help with the OAuth bit. However, I don't think the Web API accepts much in the way of input. I'm guessing you didn't get that part of it working on the sim.
Best AnswerHmm okay. What do you think would be the easiest option then? Just sending it to a companion then to a server as you mentioned before?
Best AnswerIf you go with the Web API (TCX) approach, you may be able to get a bit more flexibility by writing your own exercise app.
If you can't use the Web API, this and this vaguely show how to get data from watch to server or file. That demo hosts the server on the companion device (phone) only to avoid using HTTPS; if you've got access to a server elsewhere that can do HTTPS, you can use that.
Best AnswerDoes it make any difference that the only variables I'm interested in gathering are GPS coordinates? Would I still have to develop it as an "exercise app" that gathers additional data?
Best AnswerNo. The only advantage to you of building an exercise app would be because the system would automatically put the GPS (and unwanted) data into Fitbit's database, which you could then access using the Web API. That seemed closest to your original desire.
If you can do the server comms independently, then you don't need an exercise app.
Beware that any clockface/app can only collect data (eg, GPS) while it's running on the watch, and clockfaces/apps can't run in the background.
Best AnswerOh they cannot run in the background? When I was using the Fitbit simulator there was an option to have apps run in the background. Is this not the case? Also, sorry for all of the questions. I appreciate your help.
Best AnswerSorry, I wasn't clear.
A companion component can run in the background, but if the corresponding watch app isn't running, it will only run sporadically and can be woken every five minutes. That may be what you saw.
On-watch clockfaces/apps can't run when some other clockface/app is running, but they do keep running if the display goes off.
The companion can't restart a closed clockface/app on the watch.
Only an on-watch clockface/app can collect data.
Best Answer