react-native-google-fit
react-native-google-fit copied to clipboard
basalCalculation do not work correctly in getDailyCalorieSamples
i want disable basal calculation and get only active burned calories, but regardless of the passed value(true, false, null, string value, undefined), it returns with basal calories "react-native": "^0.64.0", "react-native-google-fit": "^0.18.0", code: // const options = { startDate: startDateCals.toISOString(), endDate: new Date(), basalCalculation: false, bucketUnit: BucketUnit.DAY, bucketInterval: 1 } GoogleFit.getDailyCalorieSamples(options).then(res => { setGoogleCals(res); }).catch(err => console.log(err)); //
please supply a example with expect value and incorrect value you receive.

@aboveyunhai @StasDoskalenko I got the same error, what should I do?
@alexbaishs https://github.com/StasDoskalenko/react-native-google-fit/blob/291b18a245c88e86c1b212ec8c25594764cca21a/android/src/main/java/com/reactnative/googlefit/CalorieHistory.java#L158-L166
This is the exact place where basal is calculated (which is not implemented by me), and I'm not exactly sure how the correct value/formula will be, you can twist this part of codes around in dev to check where it's the problem based on your data set.
I will come back later to fix it later if nobody come up with the solution, but currently I'm busy with some real life events.
?Please fix this bug
It looks like when basalCalculation
is true
, the average BMR is subtracted from the total calorie value. I may be misunderstanding here, but I think the result of that subtraction is active calories. In other words, if you want active calories, I think you set basalCalculation
to true
(or omit it since that's the default).
EDIT: I'm not so sure anymore. Reading through my own data for getDailyCalorieSamples()
, I'm getting calorie values of 65
for hours of the day that I know was not active.
It looks like when
basalCalculation
istrue
, the average BMR is subtracted from the total calorie value. I may be misunderstanding here, but I think the result of that subtraction is active calories. In other words, if you want active calories, I think you setbasalCalculation
totrue
(or omit it since that's the default).EDIT: I'm not so sure anymore. Reading through my own data for
getDailyCalorieSamples()
, I'm getting calorie values of65
for hours of the day that I know was not active.
I am looking at the basalCalculation
now, if the calculation works out as expect eventually, I will deprecate this field to remove the confusion, and use something like includeBmrAvg
instead. The current field, as you claimed, work the exact opposite way of the variable naming.