Skip to content Skip to sidebar Skip to footer

Google Fitness Sensors: Ondatapoint Not Being Called

I'm creating an app that tracks a user's steps using the google fit API. I've been stuck on getting the onDataPoint method to be called more than once. My code is almost the exact

Solution 1:

Issue was solved in a later SO question and my suspicion was correct. The issue is that TYPE_STEP_COUNT_DELTA 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.

In fact, the OP of the other question noticed that just removing the line gives less accurate results than replacing it with DataSource.TYPE_DERIVED, so that is advised.

Solution 2:

As i mentioned in my post that step_count of google fit uses derived datatype for everything whether It is cumulative,delta etc. I observed the results of my app for 10 iteration. I found that

  • Google fit API which is provided by google only uses derived datatype for all step_count.
  • You can also not specify the datatype ,but it can give variation in result when compared with Google Fit app.

The same thing is mentioned in Google Fit faq section. [https://developers.google.com/fit/faq

Post a Comment for "Google Fitness Sensors: Ondatapoint Not Being Called"