Can't access Android Wear heart rate sensor for Android

480 Views Asked by At

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?

1

There are 1 best solutions below

0
user2983041 On

As @AL. said, DataType was wrong.