stopMonitoringGeofence()

Stop monitoring a specific geofence.

Syntax 

1import { getGeofencingService } from 'lightning/mobileCapabilities';
2stopMonitoringGeofence(
3    id: string
4): Promise<void>;

Parameters 

  • id—(Required) Unique ID assigned to a specific geofence.

Returns 

A Promise object that resolves as void. If there’s an error, a rejected promise returns the error type of GeofenceServiceFailure.

Usage 

Use this function to stop monitoring of a specific geofence.

1myGeofenceService.stopMonitoringGeofence(geofenceId)
2    .then(() => {
3        const msg = `Successfully stopped monitoring geofence for ID:${geofenceId}`;
4        console.log(msg);
5    })
6    .catch((error) => {
7        const msg = `Failed to stop monitoring:${JSON.stringify(error)}`;
8        console.log(msg);
9    });