为什么API的CALORIES_EXPENDED值不等于Google Fit App的值?

时间:2018-03-02 07:00:30

标签: android google-fit

此代码在白天获得calo:

val cal = Calendar.getInstance()
        cal.time = Date()
        val endTime = cal.timeInMillis
        cal.add(Calendar.DAY_OF_YEAR, -1)
        val startTime = cal.timeInMillis

        val readRequest = DataReadRequest.Builder()
                .aggregate(DataType.TYPE_CALORIES_EXPENDED, DataType.AGGREGATE_CALORIES_EXPENDED)
                .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
                .bucketByTime(1, TimeUnit.DAYS)
                .build()


        Fitness.getHistoryClient(this, GoogleSignIn.getLastSignedInAccount(this))
                .readData(readRequest)
                .addOnSuccessListener { dataReadResponse ->
                    // For the sake of the sample, we'll print the data so we can see what we just
                    // added. In general, logging fitness information should be avoided for privacy
                    // reasons.
                    printData(dataReadResponse)
                }
                .addOnFailureListener { e -> Log.e(TAG, "onFailure()", e) }
                .addOnCompleteListener(OnCompleteListener {
                    Log.d(TAG, "onComplete()")
                })

价值回报:字段卡路里值= 11332.985。

但在Google Fit App显示值= 6.164 Cal。

为什么API的CALORIES_EXPENDED值不等于Google Fit App的值?

0 个答案:

没有答案