Location tracking

Send Ocamba location updates and trigger events such as push notifications when an install enters the location region.

Enable location updates, more about starting and stopping location updates see HERE.

On any location change you will inform Ocamba about users location.

If user is in location of interest device will receive push notification.

Don’t forget to enable Location updates in Signing & Capability for main target in Background modes.

In method for catching location update OcambaHoood.updateLocation method should be called.

func locationManager(_ manager:CLLocationManager, 

didUpdateLocations locations: [CLLocation]) {

if let location: CLLocation = locations.last {

 OcambaHoood.updateLocation(location: location)


An example for setting location updates:

import  CoreLocation

import  UIKit

import  OcambaHoood

class SomeClass: UIViewController,CLLocationManagerDelegate {...

// Create an instance of CLLocationManager*

let  locationManager = CLLocationManager()

 override  func  viewDidLoad() {


// Assign self as location manager delegate to receive callback from core location*

locationManager.delegate = self

// Request for authorization when app in use or always*


// If you wish to enable tracking in background set this value to true*

locationManager.allowsBackgroundLocationUpdates = true

// Pausing location updates you save power cosumption*

locationManager.pausesLocationUpdatesAutomatically = true

// Accuracy of location, default is kCLLocationAccuracyBest (type: Double)

 locationManager.desiredAccuracy = kCLLocationAccuracyBest

/** Distance filter is used for determing on which distance location sholud be updated*

 default is kCLDistanceFilterNone and it will update any movement*/

 locationManager.distanceFilter = kCLDistanceFilterNone

// Starting location update*



// MARK: -  CoreLocation protocol delegate methods        

 func  locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {

 if  let  location: CLLocation = locations.last {

// Passing captured location to Ocamba

 OcambaHoood.updateLocation(location: location)



 func  locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {

// Do some code here*


 func  locationManagerDidPauseLocationUpdates(_ manager: CLLocationManager) {

// Do some code here*