Back to All

oneSignalPushOpened

Hi

I'm trying to use oneSignalPushOpened but it doesn't work

I've followed the instructions of this ticket https://median.co/discuss/65c11214ef50a6002afc7a46 and the documentation using the bridge without the NPM package and I can't see the data sent, I've tried again but implementing median_library_ready() and the same. After trying everything I decided to install the NPM package, I'll leave my code here but it doesn't work. The last time that I rebuilt the app was 3 weeks ago.

useEffect(() => {  
    Median.onReady(() => {  
      setIsMedianReady(true);  
      Median.oneSignalPushOpened.addListener(data => {  
        setIsListenerEnabled(true);  
        setData(data);  
        if ("title" in data) {  
          setData2(data.title);  
        }  
      });  
    });  
  }, [isNativeApp]);

It's hard to find how to implement this because I couldn't find an example in the documentation but finally, I think I'm implementing it correctly. As you can see my code is quite simple and isNativeApp returns true, isMedianReady returns true, but Median.oneSignalPushOpened.addListener() is false so it looks like the addListener is not working.

I hope you can help me with this.

Thanks