StasDoskalenko / react-native-google-fit

A React Native bridge module for interacting with Google Fit
MIT License
333 stars 209 forks source link

GoogleFit.getXXXSamples(options) returns with no data #333

Open edvardmk opened 1 year ago

edvardmk commented 1 year ago

Hi, as some people reported in earlier issues, there are specific circumstances in which some of the get_XXX_Samples(options) methods return without data. I tested different setups and could narrow down the error to the following in my case:

The method fails silently returning an empty array after a runtime for about 1 minute, if the interval between startDate and endDate of the options object is bigger than ~7,3 years.

In case endDate is not provided, it will be set to now, e.g. new Date() and the same problems occurred. These are the max intervals I could determine for some of the functions: getActivitySamples 2637 days getBloodPressureSamples 2672 days getDailyNutritionSamples 2678 days getDailyStepCountSamples fails/works inconsistently, but roughly around 2637 days getWeightSamples 2686 days

getBloodGlucoseSamples and getHeightSamples don't seem to have an issue with huge intervals and I didn't test the other methods.

I hope this helps hunt down the bug and in the meantime helps others working around this issue. Also thanks for the great work so far on this library!

shmkane commented 7 months ago

https://github.com/StasDoskalenko/react-native-google-fit/issues/207#issuecomment-1144004248 does this help?