So i am trying to make a weather app and when i decline(press NO) in the popup window for enabling location, it gives me the following error: [Unhandled promise rejection: Error: Location request failed due to unsatisfied device settings.]
The important part of the code looks like this.
let { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== 'granted') {
this.setState({
errorMessage: 'Permission to access location was denied, please activate location and reopen the app.',
});
}
let location = await Location.getCurrentPositionAsync({enableHighAccuracy:true});
let lat = location.coords.latitude;
let lon = location.coords.longitude;
Note: I am using the last version of react native, i am on android, i used expo-location for this and it works perfectly when i enable(press YES) location.