title: React Native Expo Location Permission throwing Location Provider warning
body: <p>I'm trying to create a react native app using expo.<br />
  My app needs user permission to get the current location.<br />
  I have a functional component that has <code>useEffect()</code> hook to get permission asynchronously.<br />
  Code below.</p>
  <pre><code>const [location, setLocation] = useState(null);
  useEffect(() =&gt; {
          (async () =&gt; {
              let permissionStatus = null;
              if (Platform.OS === 'ios') {
                  let {status} = await Permissions.askAsync(Permissions.LOCATION);
                  permissionStatus = status;
              } else {
                  let {status} = await ExpoLocation.requestPermissionsAsync();
                  permissionStatus = status;
              }
              if (permissionStatus !== 'granted') {
                  return;
              }
              let location = await ExpoLocation.getCurrentPositionAsync({});
              setLocation(location);
              console.log(location);
          })();
      }, []);
  </code></pre>
  <p>It sometimes works without any flaws but some other times throws this warning:<br />
  <strong>Unhandled promise rejection: Error: Location provider is unavailable. Make sure that location services are enabled.</strong>
  The app shows the permission request dialog and after agreeing it turns on the location services in the phone but still throws this warning/error.<br />
  After a thorough research on this website and some other I have added <code>ACCESS_COARSE_LOCATION</code> to my <code>app.json.android.permissions</code> config and experimented with some other values, but at the end I still faced this problem often.<br />
  It is worth to mention, with all the permutations of the configs the code works perfectly and sometimes throws this error/warning for the same config.<br />
  I'm using <strong>Expo SDK 40</strong> and <code>expo-location</code> package version is <strong>~10.0.0</strong> and testing on <strong>Android 10</strong> phone using <strong>Expo Go</strong> client app.<br />
  I would appreciate any insights or advices on how to solve this problem.<br />
  Feel free to ask for any clarifications.</p>