You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd be superhappy for a PR on this. Since it's JSON being sent over the native bridge - just updating the TypeScript types to reflect the Apple recommended metadata keys should result in expected behaviour here.
I'm not quite sure about which naming convention is being used by Apple here actually. On my sleep samples I'm getting HKTimeZone and not HKMetadataKeyTimeZone, and that's coming straight from Apple Watch.
The data you're looking at - is it coming from Apple or from another data source @mordechaim? I think the docs and actual keys used by Apple might have confused not only us - but other developers using HealthKit as well.
I'm pushing to HealthKit and in order to deduplicate data (sending over an updated step count for the hour will add instead of update) I need to pass the 2 keys mentioned above. I tried using the keys without HKMetadata* prefix and it did not properly deduplicate.
(Sorry for not following up with a PR, I'm not a TypeScript guy and fear I'll do it incorrectly)
https://github.com/Kingstinct/react-native-healthkit/blob/49c81d7fcf75e7e970c6841696c858a5d0e73ce5/src/native-types.ts#L328-L329
According to Apple, the correct names are
HKMetadataKeySyncIdentifier
andHKMetadataKeySyncVersion
. I actually tried both key names, but only theHKMetadataKeyXXX
key correctly deduplicated the data.Thanks for this amazing library; it's the most comprehensive react native bridge for HealthKit ❤️
EDIT: I now notice other keys missing the
MetadataKey
prefix, such asHKMetadataKeyReferenceRangeLowerLimit
The text was updated successfully, but these errors were encountered: