react-native-health
react-native-health copied to clipboard
getSamples does not return Apple Watch activity.
Describe the bug Basically, when I try to bring up activities from an iPhone, that were created using an Apple Watch the return is always an empty array, however when the activities are created manually or created by strava it can return them.
To Reproduce Create activities with apple watch, and try to bring them in with the lib. the array will be empty, but using strava or manually, it returns what is expected.
Expected behavior I expected him to return to all activities.
Smartphone (please complete the following information):
- Device: Iphone 11
- OS: 14.4
Additional context I am trying to bring in only activities that are bike distance using the "getSamples" function. in the "initHealthKit" function I am using the following options:
const options = {
permissions: {
read: [AppleHealthKit.Constants.Permissions.DistanceCycling],
write: [AppleHealthKit.Constants.Permissions.DistanceCycling],
},
};
and as options of getSample:
const timeRange = {
startDate: data?.getUserDataCompiled.data_compiled
.last_upload_apple_health
? new Date(
data?.getUserDataCompiled.data_compiled.last_upload_apple_health,
).toISOString()
: new Date(2020, 4, 27).toISOString(),
// date: new Date(2020, 4, 27).toISOString(),
endDate: new Date().toISOString(),
type: 'Cycling', // one of: ['Walking', 'StairClimbing', 'Running', 'Cycling', 'Workout']
};
Hey, could not reproduce this behavior, if you have more information on that, please share