title: Detect coming back from app settings/background with React Native
body: <p>My app asks permission to use location services.</p>
  <p>If a user denies permission, they can click a button to go to the settings page and grant permissions.</p>
  <p>On ios, they are given the option to return directly to the app. on Android, I think they can do something similar.</p>
  <p>Is there a way to detect arriving back at the app so I can check their permissions again?</p>
  <p>I've tried with React Navigation's <a href="https://reactnavigation.org/docs/function-after-focusing-screen/#triggering-an-action-with-the-usefocuseffect-hook" rel="nofollow noreferrer"><code>useFocusEffect</code></a> hook:</p>
  <pre class="lang-js prettyprint-override"><code>useFocusEffect(
      React.useCallback(() =&gt; {
          console.log(&quot;navigated&quot;)
          return () =&gt; getPosition()
      }, [])
  )
  </code></pre>
  <p>But unfortunately, that only works when navigating between screens/routes in the app.</p>
  <p>Is there a way to detect the app transitioning from background to foreground?</p>