D5 runs Android 4.4
I want to measure the heart rate, but standard way of registerListener is not working (not hardware problem, with inbuilt app is working).
I get all sensors from device and i found this:
{Sensor name="ULPSH Heart Rate M", vendor="QuickLogic Inc", version=1, type=87, maxRange=100.0, resolution=1.0, power=1.1, minDelay=0}
In android.hardware.Sensor i don't found this type id 87 so i tried the following:
mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
mHeartRate = mSensorManager.getDefaultSensor(87);
mSensorManager.registerListener(this, mHeartRate, SensorManager.SENSOR_DELAY_NORMAL);
....
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == 87) {
//do something
}
}
but unfortunately is not working, the measurement is not getting started.
I tried this code with another sensor (Step Counter, type 19) that works well.
Any idea what I'm doing wrong?
I have the same problem. I think the problem is the firmware. You also can't get access to gyro, barometer and etc.
I found in the Launcher app how you can access the last heart rate.
System.getInt(getContentResolver(), "last_heart_rate", 0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.