Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

LocationService User Experience

Your component can deliver any user experience you desire. There are a number of common location-based features where LocationService might be suitable.
Here are a few examples of common location-based features:
  • Display a user’s current location on a map
  • Get the user’s current location when they perform an action in your app
  • Provide directional guidance for travel between the current location and another location
  • Calculate travel time from the current location to another
  • Perform an action when a user approaches a destination
  • Perform an action when a user moves a significant distance

In these examples, LocationService is usually only a part of the complete solution. Map display, route and travel time calculations, and so on are other parts that you need to implement yourself.

If your feature is a straightforward, map-based page, you can use LocationService position information along with the lightning-map base component. For more complex solutions, such as those requiring routing directions, you might need to integrate with other tools or services.