Explore Library
ExpoExpo SDK and Built-in APIs

2 items

Code QuizAdvanced

Importing an Expo SDK Module

Spot the incorrect import that breaks an expo-location call in an Expo Go app.

Codejavascript
import Location from 'expo-location';

export async function getCoords() {
  const { status } = await Location.requestForegroundPermissionsAsync();
  if (status !== 'granted') return null;

  const position = await Location.getCurrentPositionAsync({});
  return position.coords;
}

This module fails to run in Expo Go with 'Location.requestForegroundPermissionsAsync is not a function'. What is the bug?