I am trying to figure out how to run background service in react native (Android). Is it possible to run code (e.g. socket listener) while app is running in background or not. I created something simple to determine that, but seems like it's not working that way. Any help?
class HolaProject extends React.Component {
constructor(props) {
super(props);
this.state = {holaText: "0"};
var self = this;
setTimeout(() => {
self.setState({holaText: "after 10 seconds, works!"})
}, 10000);
}
render() {
return (
<DrawerLayoutAndroid renderNavigationView={() => <Text>React Native</Text>}>
<Text>{this.state.holaText}</Text>
<ProgressBarAndroid />
</DrawerLayoutAndroid>
);
}
};