How to determine the google fit action is entered manually or monitored by a sensor?

We are working on an Android app that requests the Google Fit API to get the Steps, Calories and Distance setting. We want to request actions that are NOT manually entered by the user (or to somehow identify these activities and ignore them).

The user can manually download the activity "Walking", "Running", etc., And we want to ignore such actions. We’ve explored History APIs and activity fields, but there seems to be no way to determine if actions are manually recorded or automatically added by other applications OR by telephone sensors OR wearable devices.

Can someone know a way to get actions that are not manually logged by the user?

UPDATE

Check out the topic below in the Google Fit developer community, this might help someone.

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

+6
source share
2 answers

This may not be the right way to determine the steps detected by the sensor, but in some tests it almost matches the steps that I think are recorded by the sensor.

DataSource ds = DataPoint.getOriginalDataSource ()

String dataStream = ds. getStreamIdentifier ()

If the string "dataStream" contains soft_step_delta, then we can assume that the steps are recorded from the telephone sensor. I have not tested this with a wearable device.

+5
source

I tried, as suggested by Amit above, but

DataPoint.getOriginalDataSource().getStreamIdentifier(); /*I also tried but could not achieve what I wanted*/ DataPoint.getOriginalDataSource().getStreamName(); DataPoint.getOriginalDataSource().getAppPackageName(); 

did not work at least for me when receiving data. I ended up using readDailyTotalFromLocalDevice (), as shown below, to capture the steps captured only by the device.

 Fitness.HistoryApi.readDailyTotalFromLocalDevice(mApiClient, DataType.TYPE_STEP_COUNT_DELTA).await(1, TimeUnit.MINUTES) 

I double-checked the same with some applications that avoid manual entries in their application, and the amount provided by the function above is exactly the same.

Note. If the user uses several devices and uses the application on all of them, readDailyTotalFromLocalDevice () will have a different value for each device, since the function is only responsible for returning device-specific data.

0
source

All Articles