"getCurrentPositionAsync" hangs indefinetly

  1. SDK Version: 43
  2. Platforms(Android/iOS/web/all): Android

I’m having a weird issue with getCurrentPositionAsync. I have a file called MapView.js with the following code:

componentDidMount = () => {
    this.getCurrentLocation();
}

getCurrentLocation = async () => {
        let { status } = await Location.requestForegroundPermissionsAsync();
        console.log(status + "First log")
        if (status !== 'granted') {
            this.setState({
                ...this.state,
                userLocationPermission: false
            });
            
        } else {
            console.log(status + "Second log")
            let location = await Location.getCurrentPositionAsync({});
            console.log(location + "Third log") // Anything beyond this line doens't run. The above line just hangs indefinetly.
            this.setState({
                ...this.state,
                latitude: location.coords.latitude,
                longitude: location.coords.longitude,
                userLocationPermission: true
            });
        }
    }

It just stops and doesn’t continue past that specific line. Am I doing something wrong or what is happening? This code used to work without issue.

Hey @binaryvigilante, I would back track through your commits until you get to a point where the code was working. Have you been able to test this on multiple devices?

Cheers,
Adam

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.