I'm trying to access to the heart rate sensor of my LG Watch Urbane using this code on MainActivity.java:
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mHeartRateSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE); boolean sensorRegistered = mSensorManager.registerListener(this, mHeartRateSensor, SensorManager.SENSOR_DELAY_NORMAL); Log.d("Sensor Status:", " Sensor registered: " + (sensorRegistered ? "yes" : "no"));
The problem is that I get this error:
E/SensorManager: sensor or listener is null
That error happens because there isn't a sensor with TYPE_HEART_RATE associated. So, I wrote some code in order to get the full list of sensors with the method .getSensorList(Sensor.TYPE_ALL) and I got this:
I don't see any heart rate sensor there, so I don't know what type number I have to use in order to get data from it.
Anyone knows what am I doing wrong?
Thanks in advance.