stopWatchingPosition(watchId)

Unsubscribes from location updates for the mobile device.

This function will be retired in a future release. From feedback, we’ve determined that the limitations of the API render it unsuitable for many customer use cases. Additional Android and iOS platform constraints require us to fully reevaluate our approach. We’re exploring the possibility of replacing this API in a future release.

Note

Syntax 

1import { getLocationService } from 'lightning/mobileCapabilities';
2stopWatchingPosition(watchId: number): void;

Parameters 

  • watchId—(Required) An integer identifier for an active location subscription, returned by a call to startWatchingPosition().

Returns 

None.

Usage 

This function ends an existing subscription to location updates.

1stopTracking() {
2  let locationService = getLocationService();
3  locationService.stopWatchingPosition(this.myLocationWatchId);
4}

Calling stopWatchingPosition() releases resources used to track the current location. You can’t reactivate a watch that’s been stopped. Create a new location subscription with startWatchingPosition() instead.

See Also

Release Preview

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.