Show the current position on a map, provide directions, save the location when creating or updating a record, and otherwise add location awareness to your branded mobile apps.
Note Using the LocationService API to create contact-based features works only in the mobile
app, and not on mobile or desktop web.
You can develop and implement a Lightning web component using the LocationService API to get the current location, location updates, and access location-based features for your mobile app users.
Using LocationService in your Lightning web component is straightforward.
- Import LocationService into your component definition.
- Test to make sure LocationService is available before you call location functions.
- Use the location functions to get or track the current location.
For complete details, see Use Location on a Mobile Device in the Lightning Web Components Developer Guide.
Note To use LocationService API with a Mobile Publisher Android app, turn on the Fine Location
app permission in Setup for Mobile Publisher. See Enable App Permissions for Device Capabilities for instructions.