# TripLocations

Provides an API for receiving locations during trips.

## TripLocations API

### `startReceivingUpdates(with:_:)`

Starts delivering periodic location updates during the trip. To stop the updates, call [stopReceivingUpdates()](#stopreceivingupdates).

If this method returns `TripLocationsStartReceivingResult.success`, the provided handler becomes the active handler. A previously registered handler will no longer receive trip location updates.

If this method returns any value other than `TripLocationsStartReceivingResult.success`, no changes will be made to the previously registered handler. It remains active and continues receiving location updates.

```swift
func startReceivingUpdates(
        with interval: TimeInterval,
        _ locationHandler: @escaping (TripLocation) -> Void
) -> TripLocationsStartReceivingResult
```

<table><thead><tr><th width="194.53814697265625">Parameter</th><th></th></tr></thead><tbody><tr><td>interval</td><td>The desired time interval, in seconds, between successive location updates. Must be at least 1 second. The actual delivery cadence may vary depending on system conditions.</td></tr><tr><td>locationHandler</td><td>A closure invoked on the main thread with the latest <a href="/pages/HVYrxLkQSVXohuViuwNp">TripLocation</a> when available.</td></tr></tbody></table>

### `stopReceivingUpdates()`

Stops delivering trip location updates.

Call this method to stop delivery of location updates to the handler that you previously supplied to [startReceivingUpdates(with:\_:)](#startreceivingupdates-with).

```swift
func startReceivingUpdates(
        with interval: TimeInterval,
        _ locationHandler: @escaping (TripLocation) -> Void
) -> TripLocationsStartReceivingResult
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sentiance.com/important-topics/sdk/api-reference/ios/triplocations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
