Monitor Geofence Regions on a Mobile Device

A Lightning web component can use a mobile device’s location features to determine a user’s current location to the user’s proximity to areas that may be of interest, or to perform location-related tasks. The longitude, latitude, and radius define a geofence around the regions of interest.

Geofence location is determined locally on the mobile device, and doesn’t need a network connection. However, GeofencingService does require a GPS signal from the device. For Android devices, Google Location Accuracy must be enabled in the system settings. GeofencingService does require access to platform-specific APIs that are available only within compatible Salesforce mobile apps.

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

Important

  • GeofencingService User Experience

    Your component can deliver any user experience you desire. There are a number of geofencing-based features where GeofencingService might be suitable.

  • Use the GeofencingService API

    To develop a Lightning web component with location-based features for creating and monitoring geofences, use the GeofencingService API.

  • GeofencingService Example

    Here’s a basic example of a Lightning web component that uses GeofencingService to monitor when a user arrives at or departs from a geographic region.

  • Compatibility and Requirements

    GeofencingService is a JavaScript module that provides an API to Lightning web components to make mobile hardware and platform (operating system) features available in JavaScript. It requires access to device hardware and device platform APIs. This access is only available when GeofencingService runs within a compatible Salesforce mobile app. It does not and cannot function when running in a standard web browser, whether the browser runs on a desktop or mobile device.

  • Considerations and Limitations

    Consider these guidelines and limitations when developing features that use the GeofencingService API.

See Also