1

I want background listener to update status, just like firebase provide us messages().setBackgroundMessageHandler.

One signal version

"react-native-onesignal": "^4.0.3",

Zuhair Naqi
  • 1,162
  • 11
  • 21
  • Facing the same issue on IOS, Please me out I'm stuck last two days :( – Saad Qamar Jan 29 '21 at 11:02
  • I tried to use the ```4.0.3``` version of onesignal too. I had too many problems, even in the initial setup and other stuff. So I've decided to use the old version ```3.9.3``` and everything os working good. – Gabriel Menezes da Silva Jan 29 '21 at 11:29
  • @GabrielMenezesdaSilva is background notification listener is available in old version? If yes can you please tell us the name? – Zuhair Naqi Jan 30 '21 at 14:55
  • Yes, it is available. I don't think it has a background listener but it has two listeners ```OneSignal.addEventListener('received', onReceived)``` and ```OneSignal.addEventListener('opened', onOpened)```, the first one is for when the notification arrives and the second one is for when the notification gets opened. You can take a look at the [docs](https://documentation.onesignal.com/docs/react-native-sdk-version-3#handling-notifications) for more details. – Gabriel Menezes da Silva Feb 02 '21 at 11:19

1 Answers1

-1

hi guys I found a solution Just use this code: messaging().setBackgroundMessageHandler(async remoteMessage => { console.log('Message handled in the background!', remoteMessage); });

Here in this code firebase will take care and get one signal's background notifications. One signal doesn't have any handler to fetch the background notifications in react native.

I hope this solution works.