Is there anyhow to debug this? My listeners don't fire for some reason, actually havent' tested the other three since the (_onIds) is not even firing. There were no build errors, no console.logs whatever. I have yet to test this on a real device though i doubt this will change anything since it was working before the previous versions (RN 0.39.0, react-native-onesignal 2.0.0) before i upgraded to RN 0.41.1
```
componentWillMount() {
OneSignal.addEventListener('received', this._onReceived);
OneSignal.addEventListener('opened', this._onOpened);
OneSignal.addEventListener('registered', this._onRegistered);
OneSignal.addEventListener('ids', this._onIds);
}
```
_onReceived = (notification) => {
// console.log('Notification received: ', notification);
}
_onOpened = (openResult) => {
// console.log('Message: ', openResult.notification.payload.body);
// console.log('Data: ', openResult.notification.payload.additionalData);
// console.log('isActive: ', openResult.notification.isAppInFocus);
// console.log('openResult: ', openResult);
}
_onRegistered = (notifData) => {
// console.log('Device had been registered for push notifications!', notifData);
}
_onIds = (device) => {
console.log(device)
}
RN 0.41.1
Android 6.0 genymotion
react native onesignal 3.0.2
Hi @jjdp .
Could you try to run the example project, and see if you get the data from onIds?
If you still can't find what's wrong, i'd be happy to help you debug it if you have a repo with the error reproduced, or to set a TeamViewer meeting to see what's wrong.
ok apparently it needs to be on index.android.js... it doesn't work on other components. Why is it like that? It is harder to configure than before. I have to pass props on my Scenes now because im using https://github.com/aksonov/react-native-router-flux
I'm using the same router and it is very much reasonable that the push notifications handling code should be handled on the main index files or the . /App file. How are you controlling it?
Well i have a OneSignalController and it has stopped working.
I want to add the deviceId into Redux, should I have redux in the index ?
@note89 just pass props
You need to add OneSignal.configure(); after all add event listeners.
Most helpful comment
You need to add OneSignal.configure(); after all add event listeners.