0

Does anyone have links to sample code that shows how to set up heart sensor data retrieval directly from CanvasWatchFaceService or CanvasWatchFaceService.Engine ?

(Most of the code I've seen thus far perform sensor data retrieval from a wearable's Activity class, but not from a watch face environment.)

I've tried setting things up this way:

private class Engine extends CanvasWatchFaceService.Engine implements SensorEventListener {
    ...
    ... // implement interface methods
}

But I keep getting a null object for my sensor.

My manifest contains:

<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.BODY_SENSORS" />
Mathemats
  • 1,185
  • 4
  • 22
  • 35
Oke Uwechue
  • 314
  • 4
  • 14

1 Answers1

2

Check if you requested android.permission.BODY_SENSORS permission in your both mobile and wearable AndroidManifest.

Also, look into the logcat of your wearable device and grep for android.permission.BODY_SENSORS.

gruszczy
  • 40,948
  • 31
  • 128
  • 181
  • Thnx. Yes I've added that permission to the mobile project also, but to no avail; I still get a null sensor object. I'm using a Moto360 device - could **that** be the problem? AFAYK, does Moto360 block access to the heart rate sensor? – Oke Uwechue Mar 17 '15 at 16:06
  • Did you look into the logcat and grep for the BODY_SENSORS? Check if you get the permission. – gruszczy Mar 17 '15 at 16:23
  • 1
    Just sharing: I followed this solution but failed in the first hour. I was so mad and restarted the watch. Then the problem solved.... – TimeString Apr 14 '15 at 05:25