Agontuk / react-native-geolocation-service

React native geolocation service for iOS and android
https://www.npmjs.com/package/react-native-geolocation-service
MIT License
1.6k stars 291 forks source link

error: Location settings are not satisfied. #304

Closed andkom closed 2 years ago

andkom commented 2 years ago

Earlier I've used react-native-maps's fused location provider and everything worked fine. After I switched to react-native-geolocation-service some users reported that they don't receive location updates.

Version: 5.2.0

Code:

const useLocation = () => {
  const dispatch = useDispatch();

  useEffect(() => {
    if (!locationPermission) {
      return;
    }

    const watchId = GeoLocation.watchPosition(
      (geoPosition) => {
        dispatch(...);
      },
      (err) => {
        console.warn('Unable to get location', err);
      },
      {
        enableHighAccuracy: true,
        distanceFilter: 0,
        interval: 5000,
        fastestInterval: 1000,
        showLocationDialog: false,
        forceRequestLocation: true,
      },
    );

    return () => {
      GeoLocation.clearWatch(watchId);
    };
  }, [dispatch, locationPermission]);

  return null;
};

Steps to duplicate:

If I set showLocationDialog to true and then reject location dialog, watchPosition returns location successfully.

frankbolviken commented 2 years ago

Did you manage to solve this? Getting the same on some devices

andkom commented 2 years ago

@frankbolviken not yet, I use this lib with showLocationDialog: true

frankbolviken commented 2 years ago

I mean. Just closing the issue without any comments. I like it.

Agontuk commented 2 years ago

Github automatically closes issues when relevant fixes are pushed :)