简体   繁体   中英

Can't access Android Wear heart rate sensor for Android

I'm trying to access the heart sensor of LGW150 Android Wear device from Android device.

For them I am using Google Fit:

https://developers.google.com/fit/android/

The Sensors API provides access to raw sensor data streams from sensors available on the Android device and from sensors available in companion devices , such as wearables.

 for (DataSource dataSource : dataSourcesResult.getDataSources()) {
                    Log.i(TAG, "Data source found: " + dataSource.toString());
                    Log.i(TAG, "Data Source type: " + dataSource.getDataType().getName());

Full demo code:

https://developers.google.com/fit/android/sensors

I only get data of step counter of android device and step counter of android wear device

Android device:

DataSource{derived:Application{com.google.android.gms::null}:Device{samsung:SM-J510FN:46114734::1:2}:live_step_deltas:DataType{com.google.step_count.delta[steps(i)]}} Type: com.google. step_count .delta

Android wear device:

DataSource{raw:Generic ANT+ Sensor:Application{com.dsi.ant.plugins.antplus::null}:AntPlus.0.124:DataType{com.google.step_count.delta[steps(i)]}} Type: com.google. step_count .delta

Why am I not getting the data from the heart rate sensor if the device has this sensor?

As @AL. said, DataType was wrong.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM