session.location reports the phone’s GPS position. Get a single fix with
getOnce(), or subscribe to a stream with onUpdate().
src/background/index.ts
LOCATION permission in your
manifest. Without it, the phone
rejects both paths with PERMISSION_NOT_DECLARED and no reading arrives.
A single fix
getOnce() resolves with the next available reading from the phone. Use it at
app load to seed your UI before a stream starts.
Promise<LocationData>.
Continuous updates
onUpdate() delivers a LocationData every time the position changes. It
returns an unsubscribe function.
LocationData
Both paths hand you the same shape:Permission
session.location.hasPermission is true when LOCATION is declared in your
manifest. It reports the manifest declaration, not the OS grant: if the user
denied the system location prompt, getOnce() and onUpdate() produce no
reading. See Permissions.
LOCATION and BACKGROUND_LOCATION are separate manifest keys, and
hasPermission checks for LOCATION only. For turn-by-turn directions built on
position, see session.navigation.
