jareddlc / OpenFit

Open source application for the Samsung Gear Fit
MIT License
87 stars 48 forks source link

Running, walking and sleeping data synchronization with google fit #32

Closed winni159 closed 8 years ago

winni159 commented 8 years ago

Hi, i made some new features for this app. OpenFit can now read walking, running, sleeping and heart rate data from the bracelet. All this data are synchronized with Google Fit. The data can be shown in app (last 3 records from each). I made some changes in weather updates and calendar notifications too.

etatus commented 8 years ago

Great work!! Can't wait Jared merge the branch to release a new version :)

jareddlc commented 8 years ago

awesome work! I hope to test this PR this week and make changes as necessary.

jareddlc commented 8 years ago

Tested it just now. Looks good. I will need to make a few changes before merging. Thanks again!

winni159 commented 8 years ago

Hi jared! After a week of testing i found some bugs in my solution:

  1. Sleep data - there are two types of sleep data, SleepResultsRecord and SleepInfo. SleepResultsRecord store info about one sleep cycle (from-to) and it has an index to SleepInfo data buffer. After a few sleep cycles, the SleepInfo buffer in the bracelet is full and oldest data are deleted. SleepResultsRecord still contains old non-exists indices to SleepInfo buffer and the OpenFit app crashes during sync with gFit because of it.
  2. After a few sync cycles the "getSession" function returns null in last start time for an exercise session stored in the google fit and the exercise data are duplicated (steps, cals and distances).

I am working on a fix right now.

jareddlc commented 8 years ago

awesome, I will pull your changes into my local branch, as I already began changing things around.

etatus commented 8 years ago

@winni159 I could see that in your branch the profile data is shown in the OpenFit popup when you retrieve data from the band. Are you syncing those data too? It would be awesome to keep updated the weight history in Google Fit by registering the data from the band.

winni159 commented 8 years ago

Hi, im almost done with fixes, tomorow i will make some tests. And i have good news for @etatus, profile data are synchronized too (height and weight)

etatus commented 8 years ago

Great news! I can't wait to try the new release! ^^

etatus commented 8 years ago

@jareddlc Could you please enable the sync button in fitness dialog to allow the manual syncing? I miss that every time I need to check my recent activity in Google Fit.

Thank you!

winni159 commented 8 years ago

Hi @jareddlc, i pushed some fixes and changes to this merge request. Can you test it, make some changes if needed and merge it? Thanks

jareddlc commented 8 years ago

I am working on this PR, there was alot changed so I need to make sure things look good

jareddlc commented 8 years ago

currently this isnt working for me as I am getting a force close on sync

jareddlc commented 8 years ago

@winni159 there is an issue with insertSleepData I briefly tried looking at the issue. I will wait to see if you have a fix or not.

winni159 commented 8 years ago

Hi @jareddlc, i found problem in steps interpolation between pedometer and exercise which caused inaccuracy in sync (someone mentioned it on xda). I made a fix and currently i am testing it. Also all data are sync without delay now, so after manual or periodical sync you have the same steps count in the bracelet and google fit.

jareddlc commented 8 years ago

hey @winni159 any luck getting a PR for the issue mentioned above?

winni159 commented 8 years ago

Hi @jareddlc, issue fixed in new pull request

jareddlc commented 8 years ago

merged! thanks @winni159