Google Fit Api filter manually added activities

2019-02-20 21:20发布

问题:

Google Fit allows users to add activities manually and programatically. Is it possible to filter out manually or programtically added activities from either the Android Api or the REST Api?

I want to query for only activities that were actually tracked and recorded at the time they were performed.

回答1:

There is no proper way according to the documentation. But I found some solution to identify manual and automatic tracked activities in Android API.

DataSource ds = DataPoint.getOriginalDataSource()
String streamData = ds.getStreamIdentifier()

If "streamData" contains "user_input", then it assumes the activities to be manual activities, either it contains "detailed" for actual sensor recorded activities.