fit-samples icon indicating copy to clipboard operation
fit-samples copied to clipboard

Error: I cannot use sensor client with TYPE_ACTIVITY_SEGMENT and TYPE_CALORIES_EXPENDED dataType

Open linhttbk opened this issue 4 years ago • 0 comments

Hi there, I got some problems with real-time display data in my application. I use SensorClient to listen to calorie data change. When my calories data change on Google Fit, the onDataPoint function was not invoked. When I use sensor client for listening to the Step Count data change, it works properly. Please explains to me why I cannot use SensorClient for listening to TYPE_CALORIES_EXPENDED data type. Here is my code: Fitness.getSensorsClient(context, account) .add(SensorRequest.Builder().setDataType(dataType) .build(), dataPointListener) .addOnSuccessListener { Log.e("registerDataPointUpdateListener: ", "Success for $dataType") }.addOnFailureListener {
Log.e("registerDataPointUpdateListener: ", "Fail ${it.message}") } I saw this one in my logcat: W/Fitness: No live data sources available for SensorRegistrationRequest{type DataType{com.google.activity.segment[activity(i)]} source null interval -1 fastest 0 latency 0}. Returning success. Will start recording once data source is live [CONTEXT service_id=17 ]

linhttbk avatar Jul 28 '20 10:07 linhttbk