Skip to main content
This guide will walk you through implementing location tracking with the Radar iOS SDK, from installation through your first tracking call.

What You’ll Build

In this quickstart, you’ll:
  1. Install and initialize the Radar SDK
  2. Request location permissions from the user
  3. Track the user’s location once (foreground tracking)
  4. Set up a delegate to receive events
  5. Start background tracking

Step 1: Installation & Setup

1

Install the SDK

First, install the Radar SDK using CocoaPods or Swift Package Manager. See the installation guide for detailed instructions.For CocoaPods, add to your Podfile:
Then run:
2

Configure Info.plist

Add location permission descriptions to your Info.plist:
3

Initialize the SDK

In your AppDelegate.swift, initialize Radar with your publishable key:
Replace prj_live_pk_... with your actual publishable API key from the Radar dashboard.

Step 2: Request Location Permissions

Create a location manager to request permissions:
iOS 13.4+ requires a two-step permission flow: first request “When In Use” permission, then request “Always” permission for background tracking.

Step 3: Track Location Once

Now let’s track the user’s location once (foreground tracking):

Understanding the Response

The trackOnce completion handler receives:
  • status: A RadarStatus enum indicating success or failure
  • location: A CLLocation object with the user’s coordinates
  • events: An array of RadarEvent objects (geofence entries/exits, place events, etc.)
  • user: A RadarUser object with the current user state
  • .success - Location tracked successfully
  • .errorPublishableKey - SDK not initialized
  • .errorPermissions - Location permissions not granted
  • .errorLocation - Location services error
  • .errorNetwork - Network error
  • .errorBadRequest - Invalid request parameters
  • .errorUnauthorized - Invalid API key
  • .errorRateLimit - Rate limit exceeded
  • .errorServer - Server error
  • .errorUnknown - Unknown error

Step 4: Set Up a Delegate

Implement RadarDelegate to receive events and location updates:
Set the delegate in your AppDelegate:
Keep a strong reference to your delegate (as shown above) to ensure it receives callbacks.

Step 5: Start Background Tracking

Enable continuous background tracking with one of the preset tracking modes:

Tracking Presets

Radar provides three preset tracking modes optimized for different use cases:
Best for: Most apps
  • Updates every ~2.5 minutes when moving
  • Shuts down when stopped to save battery
  • Low battery usage
  • Requires location background mode

Custom Tracking Options

You can also create custom tracking options:

Step 6: Identify Users

Optionally identify users with a custom ID:
If you don’t set a user ID, Radar automatically identifies users by device ID (IDFV).

Complete Example

Here’s a complete working example:

Testing Your Integration

To test your integration:
1

Run the app

Build and run your app on a physical device (simulator location is less accurate).
2

Grant permissions

Accept the location permission prompts when they appear.
3

Track location

Tap your “Track Once” button to send a location update to Radar.
4

View in dashboard

Open the Radar dashboard and go to the Users page to see your location update.
Enable debug logs to see detailed SDK activity:

Next Steps

Now that you have basic tracking working, explore more features:

Create Geofences

Set up geofences in the Radar dashboard

Trip Tracking

Track multi-stop trips with live ETAs

Search Places

Search for nearby places and chains

API Reference

View the complete SDK reference

Common Issues

Make sure you’ve added the required NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription keys to your Info.plist.On iOS 13.4+, you must request “When In Use” permission before requesting “Always” permission.
Verify that:
  • You’ve enabled the Location updates background mode in Signing & Capabilities
  • The user granted “Always” location permission (not just “When In Use”)
  • You called Radar.startTracking() with valid tracking options
Make sure:
  • You’ve set a delegate with Radar.setDelegate()
  • You’re keeping a strong reference to your delegate object
  • You’ve created geofences in the Radar dashboard
The trackOnce() method is subject to rate limits. For continuous tracking, use startTracking() instead, which handles rate limiting automatically.

Get Help

Have questions? We’re here to help!