react-native-health
react-native-health copied to clipboard
Check permission
I'm getting 1 in AppleHealthKit.Constants.Permissions.HeartRate and it could be turned on or turned off it'll be always 1
testing in: IOS 16
here code: const permissions = { permissions: { read: [ AppleHealthKit.Constants.Permissions.BloodGlucose, AppleHealthKit.Constants.Permissions.HeartRate, ], write: [ AppleHealthKit.Constants.Permissions.BloodGlucose, AppleHealthKit.Constants.Permissions.HeartRate, ], }, } as HealthKitPermissions
appleHealthKit.getAuthStatus(permissions, (err, response) => { // when I turned off HeartRate but turned on BloodGlucose I'm getting such a response: // {"read": [2, 1], "write": [2]}} // If I turned on HeartRate response will be the same })
is there anybody out there?
Looking at the getAuthStatus docs I see that it should be returning 2
if it is in fact turned on.
I'm seeing a similar issue where I have HeartRate, RestingHeartRate, SleepAnalysis and ActivitySummary all turned on, I verified by looking in the Apple Health app, yet my response looks like this:
results: Object {
"permissions": Object {
"read": Array [
1,
1,
1,
1,
],
"write": Array [],
},
}
@jaroslav009 looks like this is just a bug in the lib: check this issue
tldr: "sharing authorized" (or expecting to see 2) for read permissions is confusing. "sharing authorized" means that the app has access to write the value for that type.
I also noticed that if you haven't requested write access, the write
array won't return anything, which is annoying because the docs say it should return 0, 1, or 2... So, not sure if this function is actually helpful at all honestly
@jaroslav009 looks like this is just a bug in the lib: check this issue
tldr: "sharing authorized" (or expecting to see 2) for read permissions is confusing. "sharing authorized" means that the app has access to write the value for that type.
I also noticed that if you haven't requested write access, the
write
array won't return anything, which is annoying because the docs say it should return 0, 1, or 2... So, not sure if this function is actually helpful at all honestly
maybe is there any other option to check Heart rate? Because I can't check if it writes
I'm also getting this error, returns 1
regardless of whether the permission was allowed or not
@jaroslav009 looks like this is just a bug in the lib: check this issue
tldr: "sharing authorized" (or expecting to see 2) for read permissions is confusing. "sharing authorized" means that the app has access to write the value for that type.
I also noticed that if you haven't requested write access, the
write
array won't return anything, which is annoying because the docs say it should return 0, 1, or 2... So, not sure if this function is actually helpful at all honestly
is the bug fixed?