-
Notifications
You must be signed in to change notification settings - Fork 133
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
Support queries for nutrition (dietary/food) data types in Google Fit #17
Comments
Thanks very much for working on this. I have a question about Telerik's plugin: In the future, it would be nice to have a "nutrition" datatype that returns all the known nutrients of a given sample (or aggregated) in an object (eg { fat.total: 50, cholesterol: 0.03 }), but that would probably be more difficult to implement with HealthKit. |
Is this also working on the iOS part? |
@dariosalviwork I suspect that the nutrition samples could be queried via the separate HealthKit API (we are doing this using the Telerik plugin itself) but not via the health plugin API using the platform-agnostic type identifiers. Telerik healthkit plugin:
cordova-plugin-health
So there are multiple outstanding issues:
|
the health plugin uses the teleriks' plugin. AFAIK they are completely in sync, so there should be no missing features. 1: that's easy enough, I can do that what about aggregated values, have you tried with Telerik's plugin? |
Yes, we are using the Telerik plugin for aggregated values (by day) via As for the correlation queries, Google Fit does not actually allow individual nutrients (substances) to be queried directly. It only supports queries for |
I have extended your work, now nutrition is supported with the same interface on both Fit and HK. I have also added the data type "nutrition" that computes a summary of all known nutrients. Still to be done: store() of nutrients. |
We are currently using the Telerik HealthKit plugin to get nutrition data types from HealthKit. The cordova-plugin-health plugin does not (yet) support this.
To get nutrition data from Google Fit, query for
DataType.TYPE_NUTRITION
. For each data point, nutrients can be retrieved viadatapoint.getValue(Field.FIELD_NUTRIENTS)
and then specifiec nutrients can be retrieved vianutrients.getKeyValue(Field.NUTRIENT_TOTAL_CARBS)
.Documentation on
Field.FIELD_NUTRIENTS
:https://developers.google.com/android/reference/com/google/android/gms/fitness/data/Field.html#FIELD_NUTRIENTS
List of nutrients (constants prefixed with
NUTRIENT_
):https://developers.google.com/android/reference/com/google/android/gms/fitness/data/Field#constant-summary
Tasks:
nutritiondatatypes
query()
with appropriate unit value for each typequeryAggregated()
Eventually, support should also be added for mapping and querying the equivalent data types in HealthKit (see this list for reference). However, I don't personally need HealthKit support at the moment, so I will start with just the Google Fit side.
The text was updated successfully, but these errors were encountered: