> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zixflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Location Tracking

> Location Tracking — Zixflow iOS SDK integration guide.

Track user location to enable location-based messaging.

### 1. Add Location Permissions to Info.plist

Add these keys to your `Info.plist`:

```xml theme={null}
<key>NSLocationWhenInUseUsageDescription</key>
<string>We use your location to send relevant notifications</string>

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We use your location to send relevant notifications</string>
```

### 2. Initialize Location Module

```swift theme={null}
import ZixflowLocation

let config = SDKConfigBuilder(apiKey: "YOUR_API_KEY")
    .addModule(LocationModule(
        config: LocationConfig(mode: .onAppStart)
    ))
    .build()

Zixflow.initialize(withConfig: config)
```

### 3. Location Update Modes

* **`.onAppStart`**: Request location once when app starts
* **`.onDemand`**: Request location manually when needed

### 4. Manual Location Update

```swift theme={null}
// Request location update manually
Zixflow.location.requestLocationUpdate()

// Set last known location
if let location = locationManager.location {
    Zixflow.location.setLastKnownLocation(location)
}
```

***
