Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Expo Geolocation with emulator check
export const getCurrentLocation = (simulator) => {
return async (dispatch) => {
if (!simulator) {
let { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== 'granted') {
dispatch(gotCurrentLocationError('Permission to access location was denied'))
}
let location = await Location.getCurrentPositionAsync({});
dispatch(gotCurrentLocation(location))
} else {
// Demo location for simulator
dispatch(gotCurrentLocation(chicagoFSA))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.