Google fit API, onDatapoint method is not being invoked

前端 未结 1 1181
名媛妹妹
名媛妹妹 2021-01-29 08:24

I am not able to get step count. I\'ve been stuck on getting the onDataPoint method to be called. This code is almost correct. I am not able to find why it is not s

相关标签:
1条回答
  • 2021-01-29 08:53

    (As solved in the comments) The issue is that TYPE_STEP_COUNT_CUMULATIVE is not a raw data type—Google uses a combination of sensors, accelerometer, machine learning, etc. to determine step count. So the .setDataSourceTypes(DataSource.TYPE_RAW) line needs to be removed.

    OP noticed that just removing the line gives less accurate results than replacing it with DataSource.TYPE_DERIVED.

    Also, the Google Fit FAQ has an example which uses TYPE_DERIVED.

    0 讨论(0)
提交回复
热议问题