I’m currently working on a fitness android app that uses an external heart rate device and collecting data over Bluetooth low energy protocol. However, it is really hard to maintain that device, I'm considering to replace heart rate device with Google Fit API and using external data from other sources, etc. Android Watch.
I bought TicWatch Pro (https://www.mobvoi.com/eu/pages/ticwatchpro) and tried to subscribe to heart rate topics over Sensor API but unfortunately, the API won’t found any data source for Data Type TYPE_HEART_RATE_BPM
. I can only retrieve data from my mobile phone, like location, nothing else. With History API, the data is available from my TicWatch Pro.
Also, I checked all permissions and everything is granted. Google Account Permissions + Location Permission + Body Sensor Permission + Bluetooth ON + Location ON
Fitness.getSensorsClient(this, getGoogleAccount()).findDataSources(
DataSourcesRequest.Builder()
.setDataTypes(DataType.TYPE_HEART_RATE_BPM, DataType.TYPE_LOCATION_SAMPLE)
.setDataSourceTypes(DataSource.TYPE_RAW)
.build())
.addOnSuccessListener { dataSources ->
/**
* Only my mobile phone was found as a data source
* Missing android watch
*/
for (dataSource in dataSources) {
Timber.i("Data source found: $dataSource")
Timber.i("Data Source type: ${dataSource.dataType.name}")
if (dataSource.dataType == DataType.TYPE_HEART_RATE_BPM && dataPointListener == null) {
Timber.i("Data source for TYPE_HEART_RATE_BPM found!")
registerFitnessDataListener(dataSource, DataType.TYPE_HEART_RATE_BPM)
}
}
}
.addOnFailureListener { e -> Timber.e(e.localizedMessage) }
Is it possible to subscribe directly to Google Fit Sensor data? Can anyone share experiences using Google Fit API and Sensor API (https://developers.google.com/fit/android/sensors)? Or its maybe a problem with TicWatch Android Wear?
I would appreciate any response, thanks a lot.