You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 8, 2025. It is now read-only.
I am using the below code to find data sources because I am interested in reading data specifically from the sensor on a wearable device but not from the same type of sensor on the phone.
private fun findDataSource(){
Fitness.getSensorsClient(this, getGoogleAccount()).findDataSources(
DataSourcesRequest.Builder()
.setDataTypes(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) {
Log.i(TAG,"Data source found: $dataSource")
Log.i(TAG,"Data Source type: ${dataSource.dataType.name}")
if (dataSource.dataType == DataType.TYPE_HEART_RATE_BPM && dataPointListener == null) {
Log.i(TAG,"Data source for TYPE_HEART_RATE_BPM found!")
registerFitnessDataListener(dataSource, dataSource.dataType)
}
}
if (dataSources != null && dataSources.size == 0){
Log.i(TAG,"No data source found")
}
}
.addOnFailureListener { e -> Log.e(TAG,"failed",e) }
}
But from the above code
* Only my mobile phone was found as a data source
* Missing android watch