Permissions and location
Contents
Turn-by-turn navigation requires location on Android and iOS. Configure platform permissions, then request access from JavaScript before starting guidance.
JavaScript helper
import { requestLocationPermission } from "@trimblemaps/navigation-react-native";
const granted = await requestLocationPermission();
if (!granted) {
// Show UI explaining why location is required
}
Call this before startNavigation or mounting navigation UI that tracks the user.
| Platform | Behavior |
|---|---|
| Android | Requests ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION through the React Native permissions API when not already granted.
|
| iOS | Calls requestWhenInUseAuthorization when status is not already When-In-Use or Always.
|
On iOS, the native navigation UI may perform additional location authorization work when guidance starts. You may see a system location prompt even after requestLocationPermission() resolves true, especially if authorization was granted outside the app or only for a subset of usage. Ensure both NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription are set when you use background navigation (see below).
Android
Declare permissions in AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Request runtime permission on Android 6+ before navigation starts. Patterns match React Native Maps — Android permissions and Android location permissions.
For background tracking while navigating, follow the same background-location policies as the CoPilot Native Nav SDK Android permissions guide.
iOS
Add usage descriptions to Info.plist:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is used for turn-by-turn navigation.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Your location is used to provide navigation while the app is in use and in the background.</string>
Enable Location Updates under Background Modes in Xcode when you need guidance while the app is backgrounded or the device is locked. See CoPilot Native Nav SDK iOS permissions.
Expo: set the same keys and UIBackgroundModes (location) in app.json / app.config.js under ios.infoPlist.
Maps-only vs navigation
If your app only shows a map without guidance, see Location and tracking on the React Native Maps SDK. Navigation apps should still grant location before NavigationView or NavigationSession starts.