title: React native listening to app foreground or background switching in Android
body: <p>I have a requirement of pausing video and some other actions to perform when user clicks on home button or switch to another app using swiper action. I looked at react-native AppState, but it is not calling the event listener when home button clicked on android for some devices. Is there any compatibility minimum version requirements for the react-native app state to work?</p>
  <p>The code I tried is as below</p>
  <pre><code>useEffect(() =&gt; {
      AppState.addEventListener(&quot;change&quot;, _handleAppStateChange);
  
      return () =&gt; {
        AppState.removeEventListener(&quot;change&quot;, _handleAppStateChange);
      };
  }, []);
  
  const _handleAppStateChange = (nextAppState: any) =&gt; {
      console.log(nextAppState);
  };
  </code></pre>
  <p>The console is not printed when clicked on home button/Swiped to another app on some android devices. Is there anyway I can achieve this using react-native preferably without using any external libraries.</p>