Checking for Permissions and MapView component

I’m trying to check if location permissions granted or not. It seems location permissions from expo-permissions are not the same permissions WebView asks for?

Permissions.getAsync(Permissions.LOCATION) returns denied however I see my location on the map.

Thanks!

async componentDidMount() {
    // const { status } = await Permissions.getAsync(Permissions.LOCATION);
    const { status } = await Permissions.getAsync(Permissions.LOCATION);
    if (status !== 'granted') {
      alert('Location DISABLED');
    } else {
      alert('Location enabled');
    }
  }
 <MapView
   initialRegion={this.state.region}
   showsUserLocation={true}
   followsUserLocation={true}
   showsCompass={true}
   loadingEnabled={true}
   style={{ flex: 1 }}
   >

for future reference the import * as Location from "expo-location"; location package actually has reliable location settings checks

1 Like

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