Location & Geofencing
Pulsate uses CoreLocation geofencing to trigger location-based campaigns — for example, sending an offer when a customer walks into a store’s virtual perimeter. Geofences are defined in the Pulsate CMS; the SDK registers them with iOS and reports enter/exit events.
Requirements
Section titled “Requirements”For geofencing to work, the user must grant:
- Precise Location, and
- Allow Always location permission.
Your app must declare NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in its Info.plist (see Installing the iOS Pulsate SDK).
Starting location
Section titled “Starting location”The location permission prompt is shown when you call startLocation() — not at session start. Call it at the point in your flow where you want to ask (ideally right after a priming screen; the SDK requests Always authorization):
pulsateManager.startLocation()Opting users in / out of location updates
Section titled “Opting users in / out of location updates”Use setLocationUpdatesEnabled(_:) on PULPulsateManager to opt a user in or out of Pulsate location updates. By default, all users are opted in.
import PULPulsate
guard let manager = PULPulsateFactory.getDefaultInstance() else { return }
manager.setLocationUpdatesEnabled(true) // Opt inmanager.setLocationUpdatesEnabled(false) // Opt outRead the current preference with isLocationEnabled():
if manager.isLocationEnabled() { // Geofencing is active for this user}Reading and clearing stored locations (Swift only)
Section titled “Reading and clearing stored locations (Swift only)”For debugging or auditing, the SDK exposes the locally stored location history:
let locations: [PULLocation] = manager.getAllLocations()
try manager.resetStoredLocations() // clears the local location cacheThese two methods are Swift-only (not exposed to Objective-C).
Battery behavior
Section titled “Battery behavior”Since SDK 4.4.0, location was reworked to reduce SDK-driven location updates by more than 90% in typical use: updates are restricted when no geofence is nearby, and geofence-list refreshes wait for meaningful movement (~1 km) between refreshes. Most remaining location activity comes from the iOS Geofencing API itself.

