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

FitBitStudio Transfer File from Companion to App Clarification

Is Companion considered as FitBit Versa3?

Is App considered as FitBit App?

How do I Transfer a TextFile from Versa3 to Android Phone. Since Git is not working on SDK5. Is there a way for us to get a sample for Versa3 to transfer Acceleration data to Android Phone as a TextFile.

 

Thank you!

Best Answer
0 Votes
28 REPLIES 28

I don't understand the questions very well. Terminology may be the issue. This may help, or may be irrelevant:

  • "Companion" is the part of a Fitbit SDK project that runs within the Fitbit app on the phone.
  • "App" can refer to the part of a Fitbit SDK project that runs on the watch.

That said, the term "app" is rather ambiguous. It can refer to the Fitbit app, or to a complete Fitbit SDK project (including watch and companion parts), or specifically to the watch part of such a project. Since you seem to be contrasting 'app' with 'companion', you may mean the last-mentioned definition.

 

In addition, projects that aren't clockfaces are called apps to distinguish them from clockfaces, but in some contexts, a clockface is considered to be a type of app.

 

Sometimes context is the best way to work out what's being referred to.

Peter McLennan
Gondwana Software
Best Answer

Thanks for clarification. I was way off! So SDK5 File Transfer Project is transferring data from phone to Versa3. But I am trying to get Versa3 to send acceleration data to phone as a TextFile. Is there a tutorial. If not can someone either create a tutorial or a sample for SDK5.

 

Thank you!

Best Answer
0 Votes

Create a new SDK5 project, then you'd need to combine the accelerometer guide with the file transfer guide.

 

https://dev.fitbit.com/build/guides/sensors/accelerometer/

https://dev.fitbit.com/build/guides/communications/file-transfer/

Best Answer
0 Votes

Thank you. So when I open FitBit Studio would you like me choose FileTransfer or Sensors template to create the project framework?

Best Answer
0 Votes

I'd probably just start with a blank template and follow those guides, starting with collecting the accelerometer data, then transferring that data.

Best Answer

Thank you. I created a project using a File Transfer template simply because it has all the folders needed like companion, resources and app. This project runs successfully. But my understanding from @Gondwana that is File Transferring from the phone to Versa3.

 

Your link to File Transferring says

 

The File Transfer API allows developers to easily and reliably transfer binary and text files from the mobile companion to the device, even if the application is not running on the device.

 

But this is going to help me transfer from Phone to Versa3 which is what The Studio Template created???? I want the reverse!

 

Thank you!

Best Answer
0 Votes

If you take a look at the file transfer guide, you can see examples of each direction.

 

Device > Companion

Companion > Device

 

For your use,  you want to use the File Outbox on Device, and the File Inbox on the Companion.

Best Answer

I think the main hurdle is going to be getting the 'file' from the companion to the phone's file system. 'File transfer' delivers the file to the companion as the contents of a variable, and the Fitbit OS API doesn't provide access to the phone's file system. Hence my previous suggestions to research fetch() or WebSockets.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

I posted a solution twice...but they keep disappearing...what am I doing wrong?

Best Answer
0 Votes

I posted a solution twice...but they keep disappearing...what am I doing wrong?

Best Answer

I like to build on @SunsetRunner about this being a Great Community. 

 

What happened to my solution I posted here. The community could contribute to it if it was visible! I still don't know how to debug it.

Best Answer
0 Votes

Thank you!

 

can you point me to a working sample here or at GIT or elsewhere. The documentation to what you suggested are very cryptic at best. But you are right that looks like the crux. Some working sample will help significantly!

 

Thank you!

Best Answer
0 Votes

@Gondwana 

Thank you!

 

can you point me to a working sample here or at GIT or elsewhere. The documentation to what you suggested are very cryptic at best. But you are right that looks like the crux. Some working sample will help significantly!

 

Thank you!

Best Answer
0 Votes

 

@JonFitbit I posted a solution twice...but they keep disappearing...what am I doing wrong?

Best Answer
0 Votes

I'm not sure what you're posting. A code sample shouldn't disappear unless it contains questionable language? Try posting a link to the code instead. You could put it as a gist on github, or perhaps pastebin?

Best Answer
0 Votes

@GolfMan2000 

I can't easily provide an executable for the Android version because it would seem to be a major security risk and would be blocked from uploading/downloading. I can't publish it to the Google Play store because it's not of sufficient quality, and it only does one specific thing in one specific way which will probably suit exactly nobody. It's really only useful as a bunch of source code to show the general approach since it would need to be adapted.

 

I'd be most interested to know what your other solutions were. It's possible that a forum moderator might be able to investigate why posts have disappeared.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

import document from "document";
import { outbox } from "file-transfer";
import fs from "fs";
import { Accelerometer } from "accelerometer";

const accelLabel = document.getElementById("accel-label");
const accelData = document.getElementById("accel-data");

Best Answer
0 Votes

I attempted to post again in fragment. Look like I posted one fragment. Second fragment disappeared. Please have moderator help us!

Best Answer
0 Votes

This may not help, but it's possible that inserting code as a code sample might work better. To try this, click ... at the right side of the post toolbar thing, then </>, then paste your code in the box that appears.

Peter McLennan
Gondwana Software
Best Answer
0 Votes