I'm facing a really troubling issue with my React Native app and Pushwoosh.
If I close my app completely and send a notification from Pushwoosh control panel, it appears, I tap on it on my phone and my app receive push info.
But if my app is in background (for example, I've already opened it and just press "Home" button on my phone) and I send the notificacion from control panel, it appears, I tap on it BUT my app won't receive any push data.
It seems like onPushHandler function is being unregistered if my app is in background.
Here is my code (I removed a lot of useless code for this purpose):
import React, {
Component,
} from 'react';
import {
AppRegistry,
} from 'react-native';
class App extends Component {
constructor(props) {
super(props);
this.state = {};
this.pushHandler = this.pushHandler.bind(this);
}
componentDidMount() {
Pushwoosh.init(/* myconfig */);
Pushwoosh.register(
(token) => {
console.log('✓ Registered for pushes');
},
(error) => {
console.error('Failed to register: ' + error);
}
);
Pushwoosh.onPushOpen(this.pushHandler);
}
render() {
return (
<View><Text>Test</Text></View>
);
}
pushHandler(pushData) {
console.log(pushData);
Pushwoosh.onPushOpen(this.pushHandler);
}
}
AppRegistry.registerComponent('MyApp', () => App);