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" />
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
.