aspdev91
aspdev91

Reputation: 177

Request Raw Sensor Data (Heart Rate) using Node.js or JS for Google Fit

Is there a way to request immediate heart rate sensor data using JavaScript or Node.js? Would this be the correct command?

raw:com.google.heart_rate.bpm:com.google.android.apps.fitness:Motorola:Moto 360:480c97:manual

Also, how would I request it using Node.js? I noticed that the JSON that is outputted from the OAuth Playground contains no numeric data of value. Thanks!

Upvotes: 1

Views: 848

Answers (2)

Mr.Rebot
Mr.Rebot

Reputation: 6791

Accessing raw Sensor data may not be available to Rest API for Node.js or JS. Sensor API is only available using Android API.

Rest API Overview

enter image description here

Android APIs

enter image description here

But you can still use Node.js or JS to store and access user data in the fitness store from apps on any platform.

Get a particular data source

https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.step_count.delta:1234567890:Example%20Manufacturer:ExampleTablet:1000001:MyDataSource

Here is the Node.js github of Google. Hope it helps!

Upvotes: 0

aspdev91
aspdev91

Reputation: 177

Thank you so much! I was able to query the data by appending datasets/000000-3420845034000000000 (last parameter is start time - end time in nanoseconds).

However, there is large latency between the time the heart rate is recorded and when the data is available through the Google Fit API.

If anyone else has any solutions to getting immediate data using REST API by leveraging an existing app, please let me know!

Upvotes: 0

Related Questions