I found the solution.
The Fit app does some additional processing on top of the steps. It estimates steps based on the activity when none are recorded.
If it can help someone :
You need to use a custom DataSource of the package com.google.android.gms
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
And use this in your aggregate method like this :
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…