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

versa 3 real time HRM

Greetings,

I'm new to fitbit developer studio and wondering how could i access real time heart rate sensored data through an api as i need to display it on my project application for educational purpose.

Any help would be appreciated.

 

Regards,

sarah

Best Answer
9 REPLIES 9

It can be done, but it's difficult. You can get real-time heart rate from the device API. You need to pass that from the watch to the companion (phone), and from there to a server (which could reside on your phone). There are several threads about the process in this forum.

 

It's easier if you don't need real-time data (just use the web API).

Peter McLennan
Gondwana Software
Best Answer

We got the heart rate measurements but we want to send it to firebase how is that possible?

 

Best Answer

fetch() or websocket from Fitbit companion (I have no idea about the firebase side).

Peter McLennan
Gondwana Software
Best Answer
0 Votes
  • TypeError: Cannot create property 'code' on boolean 'true'
    • Details: watchFiles: /project/settings/index.js

I got this error maybe you could help me figure out the solution 

 

your help is really appreciated 

Best Answer

You'll need to post the source code. I'm not even sure that you should have a .js file in /settings.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Do you have a step by step explanation on how to develop the device properly and send data to companion and use the fetch command.

i feel that i'm a bit confused.

 

regards

Best Answer
0 Votes

here's the companion code I can send the data to the companion app but the problem is that i tried the fetch() and it is not working here is the companion code:

 

import * as messaging from "messaging";

 

 

  

  

const data = { "heartRate": "evt.data"};   

 

messaging.peerSocket.addEventListener("open", (evt) => {});

 

 

 

 

messaging.peerSocket.addEventListener("message", (evt) => {

 

    fetch('<API-URL>', {

 

            method: 'POST',

 

            headers: {

 

                'Content-Type': 'application/json'

 

            },

 

            body: JSON.stringify(data)

 

        })

 

        .then(response => {

 

            /*console.log(response);*/})

 

        .catch(error => {

 

            /*console.log(error);*/ });

 

});

Best Answer
0 Votes

If you search this forum, you'll find several discussions on this topic.

There are several examples of watch-to-companion communications included in this list. The Accelerometer Fetcher and Android Fitbit Fetcher could be adapted, but for real-time data you won't want to buffer readings on the watch or companion, and should probably use WebSockets rather than fetch().

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Hey I'm trying to do the exact same thing, and I got the exact same error, although it appears in my app and companion side. As far as I know, this particular error occurs as soon as you try to put in the firebase integration. Like, just importing firebase causes it. No clue how to continue... Have you resolved it?

Thanks in advance!

Best Answer
0 Votes