I'm trying to access the heart rate monitor of a Samsung Gear Live watch. The watch is paired with a 4.4.4 handset and works correctly. I'm following the official BasicSensorsApi sample.
I can successfully connect to Google Play Services with the following scope:
addScope(new Scope(Scopes.FITNESS_LOCATION_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_BODY_READ_WRITE))
But then, when I want to list all available heart rate monitors, I receive an empty list of DataSource
:
private void findFitnessDataSources() {
Fitness.SensorsApi.findDataSources(mGoogleApiClient, new DataSourcesRequest.Builder()
.setDataTypes(
DataType.TYPE_HEART_RATE_BPM)// At least one datatype must be specified.
.setDataSourceTypes(
DataSource.TYPE_RAW)// Specify whether data type is raw or derived.
.build())
.setResultCallback(new ResultCallback<DataSourcesResult>() {
@Override
public void onResult(DataSourcesResult dataSourcesResult) {
for (DataSource dataSource : dataSourcesResult.getDataSources()) {
if (dataSource.getDataType().equals(DataType.TYPE_HEART_RATE_BPM)
&& mListener == null) {
registerFitnessDataListener(dataSource,
DataType.TYPE_HEART_RATE_BPM);
}
}
}
});
If I change the DataType
to, for example, TYPE_STEP_COUNT_CUMULATIVE
or TYPE_LOCATION_SAMPLE
, the list will contain my phone, which seems logical.
Why is the watch not listed as an available DataSource
then?
Please note: This is not a duplicate of:
because I want to access the heart beat data through the recently released Google Fit API.
I don't think enabling debug mode on the watch is necessary, but I've tried that. Also, I don't think adding BODY_SENSORS
permission is necessary, because the whole process is managed by Google Fit API anyway, but I've tried that too with no luck.
The fitness store is a cloud service that persists health and wellness data using Google's infrastructure. Apps on different platforms and devices can store data and access data created by other apps.
Google Fit offers a free API to developers, though you'll need to apply for access to certain restricted data types.
The Samsung Gear Live watch does not advertise itself as a BLE heart rate monitor and therefore does not make the heart rate data available via the normal Bluetooth Low Energy API or the Google Fit API which is built upon it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With