Native APIs

How to Get the User's Location in Expo (expo-location Guide)

Add geolocation to Expo with expo-location: request permissions, get the current position, watch live updates and reverse-geocode to an address. SDK 54+.

DeveloperMill
2 min read
In this article
  1. Install
  2. Request permission and read the current position
  3. Control accuracy
  4. Watch location in real time
  5. Turn coordinates into an address
  6. Gotchas
  7. Next steps

Maps, ride-sharing, delivery tracking, weather, "find stores near me" — all of them start with the device's location. expo-location is the most-searched way to read GPS coordinates in an Expo app. This guide covers permissions, one-off reads, live tracking, and turning coordinates into an address.

Install

npx expo install expo-location

Add permission copy in app.json:

{
  "expo": {
    "plugins": [
      ["expo-location", {
        "locationAlwaysAndWhenInUsePermission": "Allow $(PRODUCT_NAME) to use your location."
      }]
    ]
  }
}

Request permission and read the current position

import * as Location from "expo-location"
import { useEffect, useState } from "react"
import { Text, View } from "react-native"

export default function Where() {
  const [coords, setCoords] = useState<Location.LocationObjectCoords | null>(null)

  useEffect(() => {
    ;(async () => {
      const { status } = await Location.requestForegroundPermissionsAsync()
      if (status !== "granted") return

      const location = await Location.getCurrentPositionAsync({})
      setCoords(location.coords)
    })()
  }, [])

  return (
    <View>
      <Text>
        {coords ? `${coords.latitude}, ${coords.longitude}` : "Locating…"}
      </Text>
    </View>
  )
}

Control accuracy

Higher accuracy costs battery and takes longer. Pick what your feature needs:

const location = await Location.getCurrentPositionAsync({
  accuracy: Location.Accuracy.Balanced, // Lowest | Low | Balanced | High | Highest
})

Watch location in real time

For live tracking, subscribe with watchPositionAsync and clean up on unmount:

import { useEffect } from "react"

useEffect(() => {
  let subscription: Location.LocationSubscription

  ;(async () => {
    await Location.requestForegroundPermissionsAsync()
    subscription = await Location.watchPositionAsync(
      { accuracy: Location.Accuracy.High, distanceInterval: 10 },
      (loc) => console.log(loc.coords.latitude, loc.coords.longitude)
    )
  })()

  return () => subscription?.remove()
}, [])

Turn coordinates into an address

const [place] = await Location.reverseGeocodeAsync({
  latitude: 37.7749,
  longitude: -122.4194,
})

console.log(place.city, place.region) // "San Francisco", "CA"

Gotchas

  • Foreground vs background: requestForegroundPermissionsAsync covers most apps. Background tracking needs extra permissions and a config plugin, and app-store review scrutiny.
  • Always remove() a watch subscription — leaving it running drains the battery.
  • Simulators let you fake a location (Xcode/Android Studio), which is handy for testing.

Next steps

Pair location with notifications for geo-reminders — see the expo-notifications guide — or cache places offline with expo-sqlite. See everything in the top 10 Expo SDK modules.

  • Expo
  • expo-location
  • Geolocation
  • React Native

Written by

DeveloperMill

A React Native and Expo team publishing production-ready app templates and practical guides on building, launching and maintaining mobile apps.

Browse our templates

Frequently asked questions

How do I get the user's current location in Expo?

Install expo-location, call `Location.requestForegroundPermissionsAsync()` to ask for permission, then `Location.getCurrentPositionAsync({})` to read the latitude and longitude from the returned `coords` object.

How do I track location continuously?

Use `Location.watchPositionAsync(options, callback)`. It streams position updates to your callback as the device moves, and returns a subscription you should remove when the screen unmounts.

Can I turn coordinates into a street address?

Yes. `Location.reverseGeocodeAsync({ latitude, longitude })` returns an array of address objects with fields like city, region, and street — useful for showing a human-readable place name.

Build it faster with a template

Production-ready Expo React Native templates with the patterns from this post already wired up.

Browse templates

More from the blog

More in Native APIs