Use Location on a Mobile Device

A Lightning web component can use a mobile device’s location features to determine the current location of the device and, by association, the person who is holding it. You can access the device’s current location at a moment in time, or you can subscribe to location changes, and receive updates to the device’s location when it changes significantly.
Location is determined locally on the mobile device, and doesn’t need a network connection. LocationService does require access to platform-specific APIs that are available only within compatible Salesforce mobile apps.

LocationService does not and cannot function when running in a web browser, whether running on a desktop or mobile device.

Important

LocationService provides coordinate data only: latitude, longitude, altitude, and some motion details. It doesn’t include derived data, such as a physical address or map detail. If you’re using the location information to, for example, show a position on a map, you might need a network connection to receive map data, such as map tiles, and so on.