Foreground location permission

Foreground location permission allows an application to access the device's location while the application is in use. In this course, the rider application requests it only when the rider selects Go online, using Expo's requestForegroundPermissionsAsync API.

Minimal example

ts
import * as Location from "expo-location";

const result = await Location.requestForegroundPermissionsAsync();

if (result.status !== "granted") {
  return;
}

Learn this concept

Lesson 5.9 · Watching foreground location

Used in exercises

Exercise 5.12 · Rider mode and customer tracking screens
Prerequisite conceptsExpo Go