I'm working on an ios react native app, I'm using webview to get data periodically, and use it in my app, but when I lock my iphone device, the webview stop sending data to react native.
onWebViewLoad() {
   setInterval(function(){
      this.refs.webview.injectJavaScript('window.ReactNativeWebView.postMessage(window.getData());');
   }, 10000);
}
handleMessage(event) {
   // receive data
   //doSomething(event.nativeEvent.data)
}
<WebView
  source={{ uri: this.state.myPage }}
  javaScriptEnabled={true}
  startInLoadingState={true}
  onLoad={this.onWebViewLoad}
  ref="webview"
  onMessage={this.handleMessage}
  />
Note: code is working fine when app in foreground or background, but when I open the app and lock the screen the webview stops sending data.
Is there a way to make the webview send data after screen lock.