Skip to main content
Track user location to enable location-based messaging.
Important: The SDK does not request location permission. Your app must call CLLocationManager authorization APIs and include Info.plist usage strings.

1. Add Location Permissions to Info.plist

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

<!-- Only if you request always authorization -->
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We use your location to send relevant notifications</string>

2. Initialize Location Module

import ZixflowDataPipelines
import ZixflowLocation

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

Zixflow.initialize(withConfig: config)

3. Location Tracking Modes

LocationTrackingMode options:
ModeBehavior
.offLocation APIs no-op
.manualYour app calls requestLocationUpdate() / setLastKnownLocation(_:)
.onAppStartSDK requests location once per launch when the app becomes active (if permission is granted)

4. Request Permission in Your App

import CoreLocation

let locationManager = CLLocationManager()
locationManager.requestWhenInUseAuthorization()

5. Manual Location Update

// Ask the SDK to request a location update
Zixflow.location.requestLocationUpdate()

// Or provide a location you already have
if let location = locationManager.location {
    Zixflow.location.setLastKnownLocation(location)
}