-
Notifications
You must be signed in to change notification settings - Fork 130
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
Null object reference error on Android when authorizing for calories.active #194
Comments
I got same error with "date_of_birth" or "gender" on requestAuthorization. |
I have removed |
@dariosalvi78 Thank you for your information. |
@dariosalvi78 do you have comments on the original issue or do you require more information? |
@wongpeiyi I still need to look into it. There may be a bug somewhere in the java code. Happy to receive pull requests if you manage to spot it before I do! |
Hi, there is a little confusion and a bug in android / healthy.js datatype calories.active not exists for android, this is calculed using basal calories and total calories. So, you need request permission for 'calories.basal' and 'calories'... and NOT for 'calories.active' (you need use a conditional for ios version..) for queryAggregated you can use 'calories.active' for both OS versions. In healthy.js you need insert retval = retval[0]; near line 99, check code below: navigator.health.queryAggregated(opts, function(retval){ retval.value -= basal_ms * (retval.endDate.getTime() - retval.startDate.getTime()); @dariosalvi78 thank you for this plugin! |
@fdmartins That fix is not valid. Adittionaly take into account that basal_ms can be 0 if the user have not changed age or height during the last year. |
Getting error message on Android only
when running:
It doesn't happen when authorizing for just calories or basal:
I suppose I could manually calculate active using the other two, but would be great if anyone knows what is happening here
The text was updated successfully, but these errors were encountered: