Moto 360
我正在尝试在我的 Android Wear 设备 ( )上获取心率传感器数据。但我不知道为什么TYPE_HEART_RATE
无法识别,应用程序显示sensor registered: no
. 其他类型,如STEP_COUNTER
return yes
。
问题是什么?!
public void onCreate() {
super.onCreate();
// register us as a sensor listener
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
Sensor mHeartRateSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE);
boolean res = mSensorManager.registerListener(this, mHeartRateSensor, SensorManager.SENSOR_DELAY_UI);
Log.d(LOG_TAG, " sensor registered: " + (res ? "yes" : "no"));
mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(Wearable.API).build();
mGoogleApiClient.connect();
}