I just try to use expo-location and I found that error Location.requestForegroundPermissionsAsync is not a function
this is my code
import * as Location from 'expo-location';
const setCurrentLocation = async() => {
let { status } = await Location.requestForegroundPermissionsAsync();
if (status !== 'granted') {
setErrorMsg('Permission to access location was denied');
return;
}
let location = await Location.getCurrentPositionAsync({});
setLocation(location);
if (errorMsg) {
setCheckText(errorMsg)
} else if (location) {
setCheckText(JSON.stringify(location))
}
}
To display the coordinates -
state
like thissetCurrentLocation
function as shownrender
part will look something like thisWorking Example