首页 > 解决方案 > 恢复 1970 年的 Google Fit 数据

问题描述

我正在编写一个小型应用程序,我需要在其中检索自 Google Fit 时间起源以来用户可能记录的所有数据,我试图以秒 (-3600) 为单位传递 1970 年 1 月 1 日的 unix 时间,但我得到一个错误,它是一个无效的日期。

我当前的代码:

val endTime = getCurrentTime()
val startTime = -3600


val readRequest = DataReadRequest.Builder()
        .aggregate(DataType.AGGREGATE_STEP_COUNT_DELTA)
        .bucketByTime(1, TimeUnit.DAYS)
        .setTimeRange(startTime, endTime,TimeUnit.SECONDS)
        .build()

谁能帮我?谢谢。

标签: androidgoogle-fit

解决方案


推荐阅读