Location Tracking

Implement the tracking of user's location in your iOS App
  1. Prerequisites
  2. Woosmap Permission
  3. Tracking Location
  4. Next Step


To enable location tracking, select your project from the Project Navigator, choose your application’s target, open the Capabilities tab, and within Background Modes, add the following capability:

You can also specify this key directly through your Info.plist as follow:


The Woosmap SDK needs Always authorization for Woosmap to work. If your app did not ask the user for the required permission, you need to add a usage description to your app’s Info.plist before requesting permission. The usage description explains why the application requires authorization. Add the NSLocationWhenInUseUsageDescription key to your Info.plist file, to define the string informing the user why you need the location services. For example:

<string>Allow app to access your location while you are using it</string>

To get access to location when the app is in the background, add the NSLocationAlwaysAndWhenInUseUsageDescription key to your Info.plist file.

<string>Allow app to access your location even when you are not using it</string>

The location services must themselves currently be enabled for the system. A request for user authorization is displayed automatically when your app first attempts to use location services.

Woosmap Permission

You should ask your users to give access Woosmap to collect their location activity. This should be done the first time the app is launched or when the user wants to change his status. This setting is saved on our side.

If tracking is set to true and if your user has not yet authorized your app to fetch locations, Woosmap will ask for it and start monitoring location changes.

Tracking Location

The Location Tracking starts after calling Now.shared.startMonitoringInBackground().

Calling startMonitoringInBackground() before setting tracking will stop Woosmap execution.

This method should be called each time your app is launched.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {     
    if (CLLocationManager.authorizationStatus() == .authorizedAlways) {
    return true

func applicationDidEnterBackground(_ application: UIApplication) {
    if CLLocationManager.authorizationStatus() != .notDetermined {

To avoid loosing data, call Now.shared.willTerminate() in the proper AppDelegate method:

func applicationWillTerminate(_ application: UIApplication) {

To make sure our datas are up to date in order to segment your users call Now.shared.didBecomeActive() in the proper AppDelegate method:

func applicationDidBecomeActive(_ application: UIApplication) {

Next Step

Congratulations! You have now successfully integrated Woosmap Geofencing SDK with your iOS app and are now sending user data to Woosmap. We suggest you proceed to read the next section to learn how to Integrate push messaging.

Was this article helpful?
Have more questions? Submit a request