How to access heart rate sensor in Android Wearable?

前端 未结 4 1588
名媛妹妹
名媛妹妹 2020-12-10 13:32

I am having problems accessing heart rate sensor on Moto 360.

I tried following things :

Sensor mHeartRateSensor = mSensorManager.getDefaultSensor(S         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-10 13:47

    I had quite a similar problem on the Moto 360. The sensor always returned 0.0f as a value.

    Then I waited for two minutes, and suddenly values!=0 came in. It seems that this sensor needs a "warmup" before showing anything. Not really astonishing if you take into account that it measures something happening roughly once a second with the unit "beats per minute". It cannot be reliable before one or two minutes have passed. And each app has its own measurement: It doesn't matter if another heartbeat app is also running (like the Moto Body thing).

    This also means that you must create a service to listen to the sensor (and a binder to pass the sensor's value to your activity or your phone).

    Have a look at the demo project I shared on github: https://github.com/upost/MyHeartbeat

提交回复
热议问题