I am unable to get Permissions dialog to open

Please provide the following:

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

I am trying to get the user to give LOCATION permission in the app but the permissions dialog never opens. In the code below, none of the console.log statements is getting executed. Somehow as soon as I request permission using askAsync(…) it never moves ahead of that step. Can anybody please help.

I am running the code on snack.expo.io
I also created a build for android and installed the apk on an Android device but same result. I have added the permission in the app.json file.

code:
_getLocationAsync = async() => {
let {status} = await Expo.Permissions.askAsync(Expo.Permissions.LOCATION)
console.log(“Location Permission” + status)
if(status !== ‘granted’){
console.log(“Permission not granted”)
return;
}
console.log(“Permission granted”)
let location = await Expo.Location.getCurrentPositionAsync({});
this.setState({location});
}

I have pretty much the same problem but moreover, the app is crashing at the same time in:
const {status} = await Permissions.askAsync(Expo.Permissions.LOCATION)

Solved.

I replaced the import statements with the below:

import * as Permissions from ‘expo-permissions’

and code with:

let {status} = await Permissions.askAsync(Permissions.LOCATION)

It started working and the permissions system dialog started showing.

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