Skip to content
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

AppleHealthKit.setObserver listener only fires when app is in foreground? #173

Open
hamxiaoz opened this issue Jul 18, 2020 · 5 comments
Open

Comments

@hamxiaoz
Copy link

hamxiaoz commented Jul 18, 2020

I'm testing in emulator and my phone with AppleHealthKit.setObserver. Here is what I found out:

Test 1 - it fires when app is foreground

  1. open react native app, make sure observer is setup
  2. open health app, manually add walking distance data
  3. go back to the react native app, the moment I open the app, I can see observer fired

Test 2 - it doesn't fire when app is in background

  1. open react native app, make sure observer is setup
  2. open health app, manually add walking distance data
  3. waited for couple of hours, nothing happened.

Can anyone confirm the observer works with background app?

@ausaquiVS
Copy link

Same issue here!

@Vollkorn01
Copy link

Hi @hamxiaoz and @ausaquiVS , did you manage to get the setObserver method running?
I'm trying to read out BloodGlucose data in the background, but for me it it doesn't even fire when the app is coming back to the foreground.
Appreciate any leads!

@lucaspbordignon
Copy link
Owner

@hamxiaoz @ausaquiVS @Vollkorn01 Hey! It seems that this repository is not being actively maintained now, so I've created a new NPM package and started to maintain and add new features there

The repo is this one and I've added some additional documentation and fixed a few issues we have related to the observers in the current build for the rn-apple-healthkit

Also have worked to allow individual observers for each identifier. Would love to hear your thoughts on that and have any additional help, in case that make sense for you guys!

@lucaspbordignon
Copy link
Owner

@Vollkorn01 Additionally, probably the BloodGlucose observer is not being triggered now because the library does not support it. Is a great option to add it, as this is a feasible feature but wasn't implemented

I've created a new issue to add support for it

@Vollkorn01
Copy link

@lucaspbordignon Great stuff that you create a new package! We decided to read out health data as soon as it is written into apple health through enablebackgrounddelivery. We outsourced this task, because there doesn't seem to be any react native implementation. If you're interested, maybe I can share the code when it is finished!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants