stopMonitoringGeofence()

Stop monitoring a specific geofence.

Syntax

import { getGeofencingService } from 'lightning/mobileCapabilities';
stopMonitoringGeofence(
    id: string
): 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.

myGeofenceService.stopMonitoringGeofence(geofenceId)
    .then(() => {
        const msg = `Successfully stopped monitoring geofence for ID:${geofenceId}`;
        console.log(msg);
    })
    .catch((error) => {
        const msg = `Failed to stop monitoring:${JSON.stringify(error)}`;
        console.log(msg);
    });