Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter manual entered data #39

Closed
AadGlasbergen opened this issue Mar 23, 2018 · 9 comments
Closed

Filter manual entered data #39

AadGlasbergen opened this issue Mar 23, 2018 · 9 comments

Comments

@AadGlasbergen
Copy link

We are developing an App which give you "Coins" when you reached an achievement. You can manually enter steps in Google Fit. Is it possible to filter out this manual entered data.

@StasDoskalenko
Copy link
Owner

@AadGlasbergen I believe you can filter it by source type

@neogermi
Copy link

@StasDoskalenko and @AadGlasbergen yes, we have done that directly in the Java code. You can filter for 'user_input' inside StepHistory.java:

+            // check if was manually input
+            DataSource ds = dp.getOriginalDataSource();
+            String streamId = ds.getStreamIdentifier();
+
+            if (streamId.toLowerCase().indexOf("user_input") != -1) {
+              // exclude this from the set
+              Log.i(TAG, "\t\tOriginalSource  : " + streamId + " -> excluded as it was manually entered");
+              continue;
+            }

@EJohnF
Copy link
Collaborator

EJohnF commented Oct 25, 2018

Now there is 'tracked' flag to check whether it was logged manually or recorded from sensors.

@StasDoskalenko
Copy link
Owner

@winardis
Copy link

Hi are there any updates to the filter on manually added entries for the package @StasDoskalenko ?

@ClementLANGENDORF
Copy link

Hi @StasDoskalenko when do you think this feature will arrive ?
@neogermi In the meantime could you please show me how and where you filter, that would be a great help. 🙏 🙏 🙏

@neogermi
Copy link

Hi @ClementLANGENDORF ,

sure. All I did was that I basically added the above mentioned code piece in StepHistory.java insice processDtaSet. This then filters for the stream where the data came from. We then filter out everything that was manually added by the user, hence "user_input".

Not the best solution but my Android-code skills are limited :-)

BTW: We then extracted this part with patch-package to apply only our changes on top of the official release. That was quite beneficial.

Hope that helps you.

@ClementLANGENDORF
Copy link

Thank you @neogermi I will try but I just saw that there was a metode GoogleFit.getUserInputSteps to allow to get the steps, it seems to work well I'll go on it.

my skills in android / java development are not the best for me either

@PhalugunaRao
Copy link

@StasDoskalenko and @AadGlasbergen yes, we have done that directly in the Java code. You can filter for 'user_input' inside StepHistory.java:

+            // check if was manually input
+            DataSource ds = dp.getOriginalDataSource();
+            String streamId = ds.getStreamIdentifier();
+
+            if (streamId.toLowerCase().indexOf("user_input") != -1) {
+              // exclude this from the set
+              Log.i(TAG, "\t\tOriginalSource  : " + streamId + " -> excluded as it was manually entered");
+              continue;
+            }

FOR samsung device getting "Samsung Step Counter" it's not user_input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants