Geofence & Location

Location Overview

By default, Netmera SDK does not collect location information from the device. To use features like geofence messaging and location-based user targeting, you must enable location tracking.

Add Dependencies (If Using a Podfile)

If your project uses a Podfile, add the following dependencies:

pod "NetmeraLocation"  
pod "NetmeraGeofence"

If you are not using a Podfile, you can skip this step.

Step 1: Enable Location History

To target users based on location, enable Location History in the Netmera web panel: Developers > App Info > App Config > Location History Enabled

Step 2: Configure Location Permissions

Add the necessary authorization keys to your Info.plist file:

  1. For Geofence Messaging (iOS 10 and earlier)

  • Set NSLocationAlwaysUsageDescription with a description of why the app uses region monitoring.

  • This allows the SDK to monitor region entry/exit actions for geofence regions configured in the Netmera Dashboard.

  1. For Geofence Messaging (iOS 11 and later)

  • Set NSLocationAlwaysAndWhenInUseUsageDescription with a description of why the app uses region monitoring.

  • This allows the SDK to monitor region entry/exit actions for geofence regions configured in the Netmera Dashboard.

  1. For Occasional Location Updates

  • Set NSLocationWhenInUseUsageDescription with a description.

  • This sends the most recent location once per session.

Step 3: Request Location Authorization

Request location access from users by calling:

Netmera.requestLocationAuthorization()

Step 4: Configure Geofence Region Limits

To set the maximum number of active geofence regions, use:

Netmera.setNetmeraMaxActiveRegions(20) // Default is 20

If you set the number greater than 20 or less than 0, it will be reset to 20 by default.

Last updated

Was this helpful?