itai neria
itai neria

Reputation: 27

How to use the r-r interval sensor in the Microsoft band SDK?

I've been trying to use the R-R interval's sensor in the Microsoft band SDK, but I can't find anything related to the sensor either on the internet and the documantation.

Could you explain me how to use it and/or give an example code?

Upvotes: 1

Views: 402

Answers (2)

Attila Tanyi
Attila Tanyi

Reputation: 5044

You will find an example with exactly that in the BandRRIntervalApp folder in the Band Android SDK and samples package. This includes subscribing to the sensor, displaying the value and getting user consent if necessary.

Upvotes: 0

Pablo Carbajal
Pablo Carbajal

Reputation: 103

The SDK documentation provides a sample for the Heart Rate sensor data and the logic is the same for RR interval. Go to section 5, page 17: https://developer.microsoftband.com/Content/docs/Microsoft%20Band%20SDK.pdf

Below are snippets if you are using the Android SDK.

First, create the event listener:

BandRRIntervalEventListener rrIntervalListener = new BandRRIntervalEventListener() {
    @Override
    public void onBandRRIntervalChanged(BandRRIntervalEvent event) {
       // add your logic
    }
};

Then register the listener (handle your BandException):

bandClient.getSensorManager().registerRRIntervalEventListener(rrIntervalEventListener);

When you are done, unregister your listener (handle your BandException):

bandClient.getSensorManager().unregisterRRIntervalEventListener(rrIntervalEventListener);

Don't forget to get user consent first, this is very important and the SDK documentation explains how to do that as well.

Upvotes: 2

Related Questions