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
Background observer is not working #308
Comments
I have same issue! |
Did y'all figure out this issue? |
Is there any update? same for me. |
@dipayanpalit15 @bewallyt @GGGava Is background observer working for anyone? |
Hey, I'll take a look on this tomorrow. But let me ask: Is the background capability on? Does the observer work when the app is on foreground? Thanks |
Try running with the dev build & with the phone plugged in (i.e., charging) and add data manually to HK and see if the observers trigger. Running the production .ipa or even the dev build without the phone charging will limit how often the background observer queries for HK events given Apple's algorithm. That's my understanding at least. |
@GGGava Background capability is on. Observers does not work even when app is on foreground. @bewallyt observers didn't work even when phone was connected to macbook and it was charging. Added data to HK manually but that didn't work. observers didn't trigger in both simulator, real device. Also check in both dev and production build but not triggered. |
Hey @dipayanpalit15 tested it locally and it seems the issue is with the Let me know if the issue persists. @Krupal5691 is your issue similar? What observer are you trying to use? |
@Krupal5691 run the dev build thru xcode and add health data (e.g., create a workout event) in the apple health app. you should at the very least see the logs being sent thru xcode like this
make sure you're registering all events like this:
|
Hi, I have a similar issue and have narrowed it down to the following If I set background observers, following new NativeEventEmitter(NativeModules.AppleHealthKit).addListener in scenarios HOWEVER, if I terminate the app and then reset/re-init the observers, now the notifications will fire in all cases. That is not optimal ofcourse. |
@mfagerdal I noticed the same behaviour just like the way you explained it. |
I'm experiencing the same behavior and haven't been able to get any type of listener to trigger while the app is in the background. Has anyone had any success with this? |
@swellander @KevinDeShawn Now I am able to trigger the observers in background mode even if app is killed by user. Also able to upload data to the server. Tested with TestFlight. I have moved listener from App.js and placed it inside AppleHealthKit initialisation. React Native : 0.72.4
|
@mfagerdal this is happening for me too. @Krupal5691's solution didn't work either. Observers only start working after allowing permissions and relaunching the app. |
Facing the same issue... I'm surprised that such a crucial feature doesn't seem to work for the average person trying it. Is this a bug or is there a specific method for using the background observer that isn't well documented? |
I am also facing the same issue, tried healthKit:StepCount:new, healthKit:Cycling:new but no success. Then I tried healthKit:Workout:new and then app triggers when we add workout session in health app manually. What I faced is when I manually adding steps/cycling/running/walking/SleepAnalysis but app does not triggers in background or in killed state. Then I tried to add cycling/running/walking from workout session then it triggers. |
I'm trying to implement background observers but it's not working.Followed updated documents for Background observers but still same issue.
Expected behavior
Should trigger the events for background observers.
Screenshots
This is my App.js file
The text was updated successfully, but these errors were encountered: