We have several customers reported this kind issues, for example, a user have 1,361 steps at day 11/17/2021, but 0 steps at 11/18/2021, but the google's app "google fit" shows 149 steps at 11/17 and 1,212 steps at 11/18.
we read log to see a dataPoint as follow: start=Wed Nov 17 23:34:17 PST 2021, end=Thu Nov 18 19:57:49 PST 2021, name=com.google.step_count.delta, fields=[steps(i)] It is as long as more than 1 day.
Questions:
- How is google's app google fit ready steps, Is it using same way as the document here? https://developers.google.com/fit/scenarios/read-daily-step-total Or it use some other ways? Or there is an algorithm update at google fit recently? Because we didn't see this issue before.
- We tried a solution to bucket by hours and sum the step, this issue gone, but it is not a good solution, it take more time, 24 times data, need more memory. Is there a good solution to avoid this issue?
Code:
val estimatedStepsDelta = DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build()
return DataReadRequest.Builder()
.setTimeRange(startTimeEpochSeconds, endTimeEpochSeconds.coerceAtLeast(startTimeEpochSeconds + 1), TimeUnit.SECONDS)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(estimatedStepsDelta, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_MOVE_MINUTES, DataType.AGGREGATE_MOVE_MINUTES)
.bucketByTime(1, TimeUnit.DAYS)
.enableServerQueries()
.build()