语言

Menu
Sites
Language
Wearable get heart rate from another app like S Health

I played a little bit with Gear Watch Designer but it is better when you actually write your own code for a watch face.

I want to display the heart rate (bpm) in the same way I'm able to do the same thing in GWD where I can select from where to pick up the data. In this case from S Health Heart Rate.

I only found examples and docs on how you can get the heart rate using the sensors but it's not what I want. I want to get the info from another app (like SHealth) that already has this info.

Found "readRecordedData" and it says that If another application has recorded data for a particular human activity type, your application can read that data. Therefore, you can use this method to read without calling startRecorder()

But unfortunately, the first param can only have the value of HumanActivityRecorderType : PRESSURE. I don't want the pressure, I want the HR.

Any ideas on how I can get the heart rate from S Health?

I'm using Gear S3  Tizen 2.3.2 for development.

Thanks!

查看选择的答案

响应

12 回复
Mark as answer
André Reus

hi, 

You can get SHealth data using SHealth SDK and transfer these data using SAP SDK ( Tizen -Android companion app) 

SHealth SDK=> http://developer.samsung.com/health

HR API of SHealth => http://img-developer.samsung.com/onlinedocs/health/android/data/index.html

Also follow this thread => https://stackoverflow.com/questions/39652983/how-to-get-pedometer-step-count-data-same-as-shealth-in-gear-s2-tizen-2-3-2

Let us know if it helps you.

Stefan Stoica

Hi André,

Thank you for the info! SHealth SDK seems the only way to get heart rate data.

Unfortunately, SHealth SDK is available only for partners. And in order to become a partner, I read that you need to have a company and perform B2B. Since I'm just a developer it blocks me. Or I misunderstood something.

Also, it doesn't seem ok a companion app for a watch face :)

Sad to find out this news.

 

Thanks again!

 

Iqbal Hossain

hi Stefan Stoica

You have three options,.... 
The best option is GWD http://developer.samsung.com/gear/design/watch-designer

2. HumanActivityMonitor API in Web app 

3. SHealth SDK ,,,in this case you have to develop companion app.... 

Stefan Stoica

Thank you for the summary, Iqbal!

Not sure why this policy but I hope Samsung will make a change in order to allow us to use SHealth data in watch faces.

This is why I would like this policy to be changed:

1. GWD it's a good IDE to develop watch faces but you cannot add custom code (css, js etc.). So the developers are limited to what they offer in IDE.

2. The data recorded by another app will be different than what SHealth collects. Not big differences but enough to confuse and annoy the user.

3. The idea to develop a companion app for a watch face doesn't sound good It's like when you want to go to the market with a helicopter. In my opinion, the companion apps are not designed for watch faces. I wouldn't download a watch face that has a companion app.

 

I hope that at some point Samsung considers to allow the developers to access SHealth data for category: http://tizen.org/category/wearable_clock

 

Thanks.

 

Iqbal Hossain

I think GWD would be the best options as you wanted to show HR on the watch face. I also agree with you that companion app for watch face will be overhead. 

Stefan Stoica

I was curious to create an Android app and get data from Shealth.

These were the problems:

- SHealth records the steps using the phone and the gear. So you have to create a filter to get the only data recorded by a specific deviceUUID (gear or phone). So, I used my gear deviceUUID;

- all good, I got the steps for today. The problem is that when the steps count from gear changes there is no updated sent to SHealth (phone). So in my app I still get the old value. Yesterday evening the gear steps count was displayed as 0 on my phone SHealth app (obviously in my app was 0 too). After I pulled down the screen SHealth data were updated on my phone. Also, I noticed that the sync is also triggered if you disconnect and connect your gear.

But this makes the companion apps useless for my purpose.... The data provided by SHealth (phone) are not reliable. Another dead end.

Thoughts?

 

Iqbal Hossain

That is very unfortunate.... Did you check the API documentation and programming guide of SAP ? May be there is a way to synch those data. Have a look carefully. 

Stefan Stoica

Using the SDK I get the data from SHealth (phone app). Since this app is not synched there is no way for me to force it.

So, if their app SHealth is not synched, the other apps just receive old data...

For heart rate seems to be ok. SHealth (from phone) is updated as soon as the gear records a new value. The synch for steps count is not ok. I haven't tested the other values.

Too many blockers and frustration for simple things. I quit developing for Samsung for the moment...

Jader Carvalho de Medeiros

Hi Stefan. I bought my first wearable device (Galaxy Watch) and I'm very excited with the Tizen API. Unfortunly I have the same problem as you to read and keep updated the steps that are displayed from SHealth.

After 1 year, did you have any news about this thread?

Stefan Stoica

Sorry to respond so late. But unfortunately, I haven't found anything so far. I took a break from developing apps for Samsung due to the API that it's not helping you. I came back here today to see what it's new in Tizen, hoping this issue was solved in a simple way. Last year I developed a watch face that gets the HR and steps (web and C++) but it wasn't very easy.

The problems that I've encountered (I don't know if something changed when I write this post). All of these were performed in Tizen 3:

- for the HR: the watch face is not running in the background and you cannot start the HR sensor. You can use the method that is called once a minute to start the sensor but how do you read the data and stop it? Your code won't continue to run because the watch face doesn't have permissions to run when it is not active. In order to avoid this, I used power privileges with CPU_AWAKE. This way the code continues to run so you can read the data from the sensor and stop it. After that, you have to release the power privileges.

- for the steps: I used a C++ service that runs in the background in order to track the user's steps. The sensor type SENSOR_HUMAN_PEDOMETER helps you tracking the steps (available since Tizen 3! so it won't work on a lot of watches). The API for watches doesn't support to start a service when the device is restarted or to detect that the service is stopped and start it. So I had to set a recurring alarm to start the service if it's not running.

These were the solutions I found, I'm not saying that they are right or there isn't another simple way to do the same thing. Maybe I'm doing something wrong and that's why it seems so complicated.

If you have other suggestions or the API has changed in the past year please share them, I'm open to learning new things.

Thanks!

 

Emil Alipiev

it is too confusing there are custom watch faces developed by others and they have this information displayed. Are they calculating themselves? we need to be able to get such simple information. Can someone from Samsung or Tizen team clarify this?

Terrebonne Cornelious

Hi,
Thank you for writing such an in-depth review. It sounds like you are looking for a specific solution that Gear Watch Designer does not currently offer. I would recommend reaching out to the developers of those apps to see if they have a way to share that data. The team hopes you continue to explore Gear Watch Designer as it offers many powerful features.