react-native-health icon indicating copy to clipboard operation
react-native-health copied to clipboard

Background Observers Issue

Open powerlinx-digicode opened this issue 2 years ago • 6 comments

Describe the bug No listeners registered warnings when listeners are registered.

To Reproduce

  1. Follow steps described here: https://github.com/agencyenterprise/react-native-health/blob/master/docs/background.md
  2. Implement listeners with following types: 'healthKit:StepCount:setup:success', 'healthKit:StepCount:setup:failure', 'healthKit:StepCount:new'

Expected behavior Listeners work correctly

Screenshots Listeners do not work. Getting warning messages (see screenshot) Screenshot 2021-12-01 at 13 58 29

Smartphone (please complete the following information):

  • Device: iPhone11

  • OS: IOS 15.0

  • Version: 1.12.0

Additional context Add any other context about the problem here.

powerlinx-digicode avatar Dec 01 '21 12:12 powerlinx-digicode

same issue here

chramos avatar Dec 14 '21 11:12 chramos

same issue here

amerdiglisic avatar Dec 29 '21 13:12 amerdiglisic

Getting the issue here also, did any of you find a solution?

cdavid138 avatar Feb 16 '22 17:02 cdavid138

Same thing here!

millro04 avatar Apr 06 '22 20:04 millro04

Same here! Anyone find a solution?

CaptainJeff avatar Apr 06 '22 22:04 CaptainJeff

Same here!

I'm on version 1.13.0 RN: 67.4 R: 17.0.2

junedomingo avatar Sep 01 '22 08:09 junedomingo

does anyone found solution for this?

KiranRadish avatar Jan 16 '23 13:01 KiranRadish

NativeAppEventEmitter is deprecated and is causing this issue, we just updated the Background Observers documentation with new instructions.

Adding a listener with NativeEventEmitter(NativeModules.AppleHealthKit).addListener(...) should solve this issue.

new NativeEventEmitter(NativeModules.AppleHealthKit).addListener(
      'healthKit:HeartRate:new',
      async () => {
        console.log('--> observer triggered');
      },
    );

GGGava avatar Jan 16 '23 21:01 GGGava