No Permission Pop-up in Android StandAlone App

Expo 27.0.1
RN 27.0.2

Trying to use location services and I do not receive the Permissions prompt and the request is denied on the standalone app only. Works fine inside of Expo.

Permission requests for Images and Camera work as expected in other parts of the app.

The code I am using is straight from the documentation, (with added Alert to verify denied permission)

    _getLocationAsync = async () => {
        let { status } = await Permissions.askAsync(Permissions.LOCATION);
        if (status !== 'granted') {
          this.setState({
            locationResult: 'Permission to access location was denied',
          });
        }
     
        Alert.alert(
            'PERMISSION STATUS',
            status,
            [
              {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
            ],
            { cancelable: false }
          )
    
        let location = await Location.getCurrentPositionAsync({ enableHighAccuracy: true });
        this.setState({ 
            latitude: location.coords.latitude,
            longitude: location.coords.longitude
         });
    };

The app.json file:

   "android": {
     "package": "com.vinderdev.app",
     "permissions": [
      "LOCATION",
      "CAMERA",
      "CAMERA_ROLL",
      "READ_INTERNAL_STORAGE",
      "READ_EXTERNAL_STORAGE",
      "WRITE_EXTERNAL_STORAGE"
    ],

Any and all insight would be greatly appreciated.

1 Like

You might want to change "LOCATION" in you app.json to "ACCESS_COARSE_LOCATION" and
"ACCESS_FINE_LOCATION". These are the keys required for location. Let us know if this works for you!

4 Likes

That worked the magic. Thank You!

I feel like this should be made more explicit in the docs- surely Iā€™m not the only person who has ran into this.

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