rn-apple-healthkit icon indicating copy to clipboard operation
rn-apple-healthkit copied to clipboard

getDailyDistanceWalkingRunningSamples not working

Open anija opened this issue 4 years ago • 3 comments

Hi,

i'm trying to get the dailyDistanceWalkingRunning but i always get an ampty array.

Data is there, and i can access it, because getDistanceWalkingRunning works fine: AppleHealthKit.getDistanceWalkingRunning({}, (err, res) => console.log(res)); Returns: {"endDate": "2020-01-29T14:40:00.000+0100", "startDate": "2020-01-29T14:40:00.000+0100", "value": 8046.72}

But the daily aggregate is empty: AppleHealthKit.getDailyDistanceWalkingRunningSamples({ startDate: "2020-01-01T14:40:00.000+0100", endDate: "2020-01-29T14:40:00.000+0100", limit: 5 }, (err, res) => console.log(res)); []

I've tried to add the limit, to remove and add again endDate... no luck. I'm using v0.8.0 on the Emulator.

anija avatar Jan 29 '20 14:01 anija

Do you tried to manually add samples in your Simulator?

Go to Health app in your simulator > click in "Health Data" from bottom tab > select "Activity" >select "Walking Running DIstance" in list > Add manually samples

akinncar avatar Feb 20 '20 14:02 akinncar

Yes, in fact i got the results when using the getDistanceWalkingRunning method.

Anyway, i managed to get the Workouts instead of the Distance and opened a PR to fix a bug about the Workout consents. This library has a lot of problem (logs forgotten, lack of documentation, etc).

anija avatar Feb 21 '20 08:02 anija

Yes, working with this lib yesterday, I watched same problems (and anothers) ;/

akinncar avatar Feb 21 '20 12:02 akinncar