如何在Android应用中访问Google Wear Os手表心率传感器数据并观看

时间:2019-11-13 11:10:03

标签: android wear-os android-sensors

是否可以在Android Wear中记录来自心率传感器的原始光数据?我知道如何从心率传感器记录BPM,但这不是我想要的。

这是我当前的代码。

    mTeleportClient = new TeleportClient(this);
    //let's set the two task to be executed when an item is synced or a message is received
    mTeleportClient.setOnGetMessageTask(new ShowToastFromOnGetMessageTask());
    latch = new CountDownLatch(1);
    final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
    stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
        @Override
        public void onLayoutInflated(WatchViewStub stub) {
            rate = (TextView) stub.findViewById(R.id.rate);
            rate.setText("Reading...");

            accuracy = (TextView) stub.findViewById(R.id.accuracy);
            sensorInformation = (TextView) stub.findViewById(R.id.sensor);

            latch.countDown();
        }
    });

    mSensorManager = ((SensorManager)getSystemService(SENSOR_SERVICE));
    mHeartRateSensor = mSensorManager.getDefaultSensor(SENSOR_TYPE_HEARTRATE); // using Sensor Lib2 (Samsung Gear Live)
    //mHeartRateSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE); // using Sensor Lib (Samsung Gear Live)
    if(mHeartRateSensor == null)
        Log.d(TAG, "heart rate sensor is null");

0 个答案:

没有答案