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

observeSteps() not working #59

Closed
maccomaccomaccomacco opened this issue Aug 29, 2018 · 9 comments
Closed

observeSteps() not working #59

maccomaccomaccomacco opened this issue Aug 29, 2018 · 9 comments

Comments

@maccomaccomaccomacco
Copy link

maccomaccomaccomacco commented Aug 29, 2018

This is the code in the main screen of my RN app

componentDidMount() {    
        GoogleFit.isEnabled( () => {
            GoogleFit.authorize();

            GoogleFit.observeSteps((steps)=>{
                Reactotron.log(steps)
            });
            const options = {
                startDate: "2017-01-01T00:00:17.971Z",  // required ISO8601Timestamp
                endDate: (new Date()).toISOString()     // required ISO8601Timestamp
            };
            GoogleFit.getDailyStepCountSamples(options, (err, res) => {
                if (err) {
                    throw err;
                }
                Reactotron.log(res);
            })
        }) 
}

I receive the log from getDailyStepCountSamples() but observeSteps() doesn't give signs of life.

@StasDoskalenko
Copy link
Owner

@marcoautiero try to call observeSteps after onAuthorize succeed

@feat7
Copy link

feat7 commented Dec 31, 2018

@StasDoskalenko I called observeSteps after onAuthorize success but not working.
Need a good example to show it working. I have tried a lot of things already.

@nojas01
Copy link

nojas01 commented Jan 25, 2019

@StasDoskalenko have the same problem. I checked my adb logs and noticed that the DataType.TYPE_STEP_COUNT_CUMULATIVE is never triggered thus never responding. It works just fine when I change he datatype to say 'TYPE_STEP_COUNT_DELTA' .
screenshot 2019-01-25 at 15 47 51

@StasDoskalenko
Copy link
Owner

Guys I'm planning to create a good example app. Any suggestions?

@jerinjohnk
Copy link

@StasDoskalenko how about creating a sample where values similar to google Fit app are retrieved and shown. UI can be skipped. But handling stuff such as authorization, observesteps etc on all android devices. Log error if sensors not present etc.

@StasDoskalenko
Copy link
Owner

@jerinjohnk good idea!

@milad1367
Copy link

I have the same problem :
step counter not work!
Screen Shot 2019-08-11 at 10 46 50 AM

@Karpengold
Copy link

@StasDoskalenko Do you plan to create example app?

@hayait599
Copy link

observeSteps does not always work, the function is not called
and sometimes it returns weird data
like this (5163 number)


01-31 21:07:36.896 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5163
01-31 21:08:49.116 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5165
01-31 21:08:49.116 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5165
01-31 21:08:49.116 31399-31399/com.test I/StepCounter: Detected DataPoint value: 2
01-31 21:08:49.126 31399-31399/com.test I/StepCounter: Detected DataPoint value: 2
01-31 21:08:49.126 31399-31399/com.test I/StepCounter: Detected DataPoint value: 2
01-31 21:08:49.126 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5165
01-31 21:08:58.256 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5168
01-31 21:08:58.276 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5168
01-31 21:08:58.276 31399-31399/com.test I/StepCounter: Detected DataPoint value: 3
01-31 21:08:58.276 31399-31399/com.test I/StepCounter: Detected DataPoint value: 3
01-31 21:08:58.276 31399-31399/com.test I/StepCounter: Detected DataPoint value: 3
01-31 21:08:58.276 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5168
01-31 21:09:02.826 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5171
01-31 21:09:02.826 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5171
01-31 21:09:02.826 31399-31399/com.test I/StepCounter: Detected DataPoint value: 3
01-31 21:09:02.836 31399-31399/com.test I/StepCounter: Detected DataPoint value: 3
01-31 21:09:02.836 31399-31399/com.test I/StepCounter: Detected DataPoint value: 3
01-31 21:09:02.836 31399-31399/com.test I/StepCounter: Detected DataPoint value: 5171

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

9 participants