Skip to main content
The Radar iOS SDK supports both local and remote push notifications for location events, enabling you to engage users based on their real-time location and behavior.

Overview

Radar supports two types of push notifications:
  • Local notifications: Triggered by location events (geofence entries/exits, beacon proximity)
  • Silent push notifications: Server-triggered notifications for campaign delivery and tracking

Setup

1

Enable push notification capability

In Xcode, navigate to your app target’s Signing & Capabilities tab.Click + Capability and add Push Notifications.
2

Configure notification permissions

Request notification permissions from the user:
import UserNotifications

UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
    if granted {
        DispatchQueue.main.async {
            UIApplication.shared.registerForRemoteNotifications()
        }
    }
}
3

Initialize SDK with notification options

Configure the SDK to automatically handle notifications:
import RadarSDK

let options = RadarInitializeOptions()
options.autoLogNotificationConversions = true  // Auto-log opened_app conversions
options.autoHandleNotificationDeepLinks = true // Auto-open URLs from notifications
options.silentPush = true                      // Enable silent push support

Radar.initialize(publishableKey: "YOUR_PUBLISHABLE_KEY", options: options)
Setting silentPush = true automatically calls registerForRemoteNotifications() and swizzles the app delegate to handle remote notifications.

Local notifications for location events

Radar can automatically show local notifications when location events occur.

Configure geofence notifications

Add notification metadata to your geofences in the Radar dashboard:
{
  "radar:entryNotificationText": "Welcome to our store! Show this notification for 15% off.",
  "radar:exitNotificationText": "Thanks for visiting! Come back soon."
}

Configure beacon notifications

Add notification metadata to your beacons:
{
  "radar:entryNotificationText": "You're near our product display!",
  "radar:exitNotificationText": "Check out more displays around the store."
}

Configure trip notifications

Add notification metadata to trip destinations:
{
  "radar:approachingNotificationText": "You're almost at your destination.",
  "radar:arrivalNotificationText": "You've arrived at your destination!"
}

Notification metadata format

For more control over notification appearance, use the full notification format:
{
  "radar:notificationText": "Check out our new arrivals!",
  "radar:notificationTitle": "Welcome to Our Store",
  "radar:notificationSubtitle": "Limited Time Offer",
  "radar:notificationURL": "myapp://store/new-arrivals",
  "radar:campaignId": "store-entry-campaign",
  "radar:campaignType": "eventBased"
}

Silent push notifications

Silent push notifications enable server-triggered location tracking and campaign delivery.

Enable silent push

1

Enable remote notification background mode

In Xcode, add Background Modes capability and enable Remote notifications.
2

Configure app delegate

When silentPush is enabled during initialization, the SDK automatically handles remote notifications. To manually handle them:
func application(_ application: UIApplication,
                 didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                 fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    Radar.didReceivePushNotificationPayload(userInfo) {
        completionHandler(.newData)
    }
}

func application(_ application: UIApplication,
                 didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    // Device token is automatically captured by the SDK
}
If you enable automatic handling with silentPush = true, the SDK swizzles these methods automatically.

Notification conversions

Track when users interact with notifications:

Automatic conversion tracking

When autoLogNotificationConversions = true, the SDK automatically logs conversions when users tap notifications:
// Automatically tracked:
// - User opens app from notification
// - Event name: "opened_app"
// - Metadata includes notification payload

Manual conversion tracking

Manually log conversions for custom notification handling:
import RadarSDK

func userNotificationCenter(_ center: UNUserNotificationCenter,
                           didReceive response: UNNotificationResponse,
                           withCompletionHandler completionHandler: @escaping () -> Void) {
    // Log conversion for Radar notification
    Radar.logConversion(response: response)
    
    completionHandler()
}
When autoHandleNotificationDeepLinks = true, the SDK automatically opens URLs from notification metadata:
{
  "url": "myapp://product/123"
}
Manually handle deep links for custom routing:
func userNotificationCenter(_ center: UNUserNotificationCenter,
                           didReceive response: UNNotificationResponse,
                           withCompletionHandler completionHandler: @escaping () -> Void) {
    let userInfo = response.notification.request.content.userInfo
    
    if let urlString = userInfo["url"] as? String,
       let url = URL(string: urlString) {
        // Handle deep link
        handleDeepLink(url)
    }
    
    completionHandler()
}

Upload APNs certificate

For server-triggered push notifications:
  1. Generate an APNs certificate in the Apple Developer Portal
  2. Upload the certificate to the Radar dashboard under Settings > Push Notifications
  3. Configure your notification campaigns in the dashboard

Custom notification handling

For full control over notification presentation:
import UserNotifications
import RadarSDK

class NotificationDelegate: NSObject, UNUserNotificationCenterDelegate {
    func userNotificationCenter(_ center: UNUserNotificationCenter,
                               willPresent notification: UNNotification,
                               withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
        // Customize notification presentation
        if notification.request.identifier.hasPrefix("radar_") {
            // Radar notification
            completionHandler([.banner, .sound, .badge])
        } else {
            completionHandler([])
        }
    }
}

// Set delegate
UNUserNotificationCenter.current().delegate = NotificationDelegate()

Best practices

Request permission at the right time

Request notification permissions when the user will understand the value, not immediately on app launch.

Keep messages relevant

Ensure notification content is contextually relevant to the location event.

Test notification campaigns

Use test devices and geofences to verify notifications before launching campaigns.

Monitor conversion rates

Track notification conversion rates in the Radar dashboard to optimize campaigns.

Troubleshooting

  • Verify notification permissions are granted
  • Check that the Push Notifications capability is enabled
  • Ensure notification metadata is properly formatted in geofence/beacon configuration
  • Check device notification settings for your app
  • Verify Remote notifications background mode is enabled
  • Ensure silentPush = true in initialization options
  • Check that APNs certificate is uploaded to the Radar dashboard
  • Verify the device token is registered
  • Ensure autoLogNotificationConversions = true or call logConversion manually
  • Check that notification identifiers start with “radar_”
  • Verify the notification delegate is properly set