Reading GPS Location with expo-location
Request foreground location permission, get the current coordinates with getCurrentPositionAsync, and display latitude and longitude on screen.
What Is expo-location?
expo-location provides an API to read the device's geographic position using GPS, Wi-Fi triangulation, and cell tower data. It works on both iOS and Android without writing native code. You can get a one-time position fix, watch the location as the user moves, or geocode an address to coordinates and vice versa.
Installing expo-location
Use the Expo install command to get the SDK-compatible version of expo-location. In managed Expo projects, the native module is linked automatically. For bare React Native projects, you must also run pod install on iOS and update AndroidManifest.xml with the location permission declarations.
npx expo install expo-locationAll lessons in this course
- Camera Access with expo-camera
- Reading GPS Location with expo-location
- Scheduling Local Notifications
- Handling Permissions Gracefully