I have enable location services on my Android device, but I keep getting the above error. It prompts me for my permissions request upon loading Expo (for the first time) but I still get the promise rejection. It used to work fine, but all of a sudden, stopped working. Below is my code requesting the permissions, and executing the location.
Note: This works fine on iOS, and this is in managed workflow.
useFocusEffect(
React.useCallback(()=> {
let isActive = true;
async function getLocationAsync() {
let { status } = await Location.requestForegroundPermissionsAsync()
if (status !== 'granted'){
setErrorMsg('Permission to access location was denied')
return;
}
let location = await Location.getCurrentPositionAsync({});
setLocation(location);
console.log('Location permissions granted')
}
console.log(location)
getLocationAsync()
console.log(Permissions.LOCATION)
console.log('Location status above')
return () =>{
isActive = false
}
},
[],
)
)
Call the function in the catch block until you get the coordinates.