androidgoogle-fitgoogle-fit-sdk

How to identify google fit activity is entered manually or tracked by sensor?


We are working on an Android application which queries Google Fit API to retrieve Steps, Calories and Distance parameter. We want to query activities which are NOT manually entered by user (or somehow identify these kind of activity and ignore them).

User's can manually load Walking, Running etc activity, and we want to ignore such activities. We looked into History APIs and Activity Fields, but it seems there is no way to identify whether activities are manually logged or automatically added by other apps OR phone sensors OR wearable devices.

Can someone knows a way to get activities which are not manually logged by user?

UPDATE

Check below thread on Google Fit Developer Community, it may help someone

https://plus.google.com/u/0/105650643673857572241/posts/fET6zKYFq4K


Solution

  • This may not be the correct way to identify sensor detected steps, but with some testing, it almost matches steps which I think recorded by sensor.

    DataSource ds = DataPoint.getOriginalDataSource()

    String dataStream = ds.getStreamIdentifier()

    If "dataStream" string contains soft_step_delta, then we can assume that steps are recorded from phone sensor. I haven't tested it with wearable device.