Install and get a location
This path ends with a button that renders foreground coordinates on iOS or Android. It deliberately requests foreground location only. Do not add background permissions unless your product must track while the app is not active.
Before you install
Your native app must use React Native 0.75 or newer, New Architecture, and Nitro Modules. Expo apps need a development/custom native build; Expo Go is not supported. iOS uses CocoaPods. See Release readiness before adopting the RC in a release branch.
1. Install an RC
Use @rc to evaluate the latest release candidate:
For reproducible testing and release approval, replace the moving tags with the exact versions from the tested reference stack.
Released npm builds prefer compatible GitHub Release prebuilts and fall back to
a native source build. Android prebuilts require matching React Native and Nitro
Modules major/minor versions. Set NITRO_GEOLOCATION_USE_PREBUILT=0 when you
need to verify the source-build path.
2. Add minimum foreground permissions
iOS
Add one product-specific explanation to ios/<AppName>/Info.plist:
Write the value for the feature the user just chose. Do not copy a vague
template into a store build. NSLocationAlwaysAndWhenInUseUsageDescription and
the location background mode are not needed for this foreground path.
Android
Add these to android/app/src/main/AndroidManifest.xml:
Do not add ACCESS_BACKGROUND_LOCATION, foreground-service, notification,
activity-recognition, boot, or wake-lock permissions for this foreground path.
3. Rebuild the native app
Install iOS pods, then rebuild rather than relying on an existing binary:
Use pod install directly when the app has no Gemfile. For Android:
React Native 0.87.x can instead use the experimental precompiled SwiftPM path. It requires Nitro Modules 0.37.1 and an app configuration helper; follow the Swift Package Manager guide exactly.
4. Check the native setup
Run the read-only doctor after adding permissions and generating native files:
The setup is ready for this guide when dependency, New Architecture, and foreground-permission checks do not report errors. Warnings about optional background declarations are expected because this flow does not use them. See Install Doctor for monorepo, CI, and JSON output.
5. Render the first coordinates
Configure once at startup. Request permission only after a user action.
Confirm the outcome
- On success, the screen shows
latitude, longitude (±accuracy m). deniedorrestrictedmeans the app must explain the feature and let the user choose whether to review system settings; do not loop permission prompts.- A timeout means no acceptable fix arrived within 15 seconds. Try outdoors or lower the accuracy requirement rather than requesting background permission.
- On Android, a provider/settings error means device location services or the requested accuracy is unavailable. Follow Troubleshooting.
Continue only for your use case
- API reference for readiness, cached reads, watches, geocoding, and heading.
- Community migration if this replaces the community callback package.
- Background Location only when the product must track while the app is not active.
