Expo Location Permission returns Denied

  1. SDK Version: 38
  2. Platforms
    Android: 10

Hello, talents.
Now I am developing an app using Expo v38 and it is using expo-location library.

I want to use this service only while using this app.

But when selecting the “Allowed Only While in USE”, it returns “denied” status.
The location service is working only by chooing “Allowed All the Time”.

This is my codebase.

let { status } = await Permissions.askAsync(Permissions.LOCATION);
    if (status != "granted") {
      this.setState({
        errorMsg: "Permission to access location was denied",
        loading: false
      });
    } else {
      let location = await Location.getCurrentPositionAsync({
        enableHighAccuracy: true
      });
      this.setState({ currentLocation: location });
    }

11

Can someone help me?
Thanks.

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