Skip to main content

How it works

The Location module captures location (with user consent) from your app and attaches it to a person’s profile in Zixflow. You can use this data for geo-aware messaging and audience segmentation with more accuracy than IP-based geolocation. When you identify a person, the SDK includes the latest location in the identify call. The SDK also sends a location update to the person’s activity timeline, which you can use in campaigns and segments. To balance location updates with battery and data usage, the SDK limits location updates (at most once a day)—and only sends that update when the person has moved a meaningful distance since the last update. The SDK does not request location permission on its own—your app must handle the permission flow. Complete Quick Start (initialize + identify) before relying on location-based campaigns. Pods: Installation. Checklist: Example Applications.

Enable the location module

Location is an optional native module. Enable it on both platforms before calling location APIs.

iOS

Add the location subspec to your ios/Podfile, then run pod install:

Android

Set the following flag in android/gradle.properties:
If the module is not enabled, location calls no-op and a one-time development warning is logged.

Initialize with location config

Add a location object to your ZixflowConfig. The trackingMode property controls how and when the SDK captures location.

Tracking modes


Request location permissions

Add the required platform keys, then request permission at runtime before calling SDK location APIs. iOS — Info.plist:
Android — AndroidManifest.xml:
Request permission with a library such as react-native-permissions:

Location APIs

You can call these methods as often as you like. The SDK caches the latest coordinates for profile enrichment, but throttles outbound location updates so you do not overwhelm your workspace.

setLastKnownLocation

Pass coordinates from your app’s own location system. This does not require the SDK to manage location permissions—your app manages access independently.

requestLocationUpdate

Request a one-shot location from the native platform’s location services. Use this if your app does not have its own location system. Your app must request location permission before calling this method—the SDK will not prompt the user. If permission is denied or location services are disabled, the request is ignored (no crash). If a request is already in progress, additional calls are ignored until it completes.

Profile switch behavior

When you call Zixflow.clearIdentify(), the SDK clears cached location data so one person’s location does not carry over to another profile. The next person you identify starts with a clean slate. Location can persist across app restarts. When your app relaunches, the SDK may restore the cached location so the next identify() call includes it automatically.