Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

App data out of device and fitbit

My app calculates a bunch of data based on the GPS.

Note, the app is NOT used next to the companion, as the phone is left behind. I can write a file on the device with all the data. Once activity is finished, app is closed. It could connect to the companion later, possibly.

 

How do I get the file into the companion and out to me afterwards?

Using the WebAPI is too reductive, as the fitibit app does not allow for breakdown of data (to my knowledge).

Best Answer
0 Votes
3 REPLIES 3

We don't currently have a file transfer from the device to the companion, so you'd need to use the Messaging API.

 

As your data is probably larger than a single message max size, you'll need to use something like the chunking example here. https://dev.fitbit.com/guides/communications/messaging/

Best Answer
0 Votes

Thanks JonFitbit

I had a feeling that was the preferred route.

 

- How do I get it in the companion if the app is not running?

- How do I get it out of the companion, for me to use/see/save?

 

Best Answer
0 Votes

To my knowledge, the only way is via the Messaging API, which is not ideal with all of the buffering you'll have to do, depending on how much data is collected.  Whoops missed the above reply.

 

You'll likely have to index your chunks so you can make sure your entire payload makes it into the companion, and in the correct order. Once it is in the companion you are free to do whatever you want with it. Getting it out of the companion depends on where you want to see/use/save it.  I'd guess most options involve posting the data via fetch, but to where is totally up to you.

 

You will not be able to communicate to the companion while the device app isn't open.  You'll just have to wait until there is a stable connection. You can make the data persist on the device with the FS api if the user closes the app before the data is able to be sent. That way you can make an "outbox" of sorts, to be "delivered" the next time the app opens and is in range of the companion.

Best Answer