iOS – Tempo

Tempo allows active tracking of a user’s location, as well as live ETA estimation.

Start Tempo

For this capability, the SDK needs to be initialized and the app must have location permission. You also need Tempo to be enabled for your Bluedot Account and can see the Tempo section in the Projects List page of your Canvas account. If that is not visible and you want to use this capability, please contact your Bluedot CX representative.

Tempo also requires Destination IDs to be defined, which you can learn about here.

To start Tempo, you should

BDLocationManager.instance()?.startTempoTracking(withDestinationId: "MyDestinationId"){ error in
    guard error == nil else {
        print("There was an error starting Tempo with the Bluedot SDK: \(error.localizedDescription)")
        return
     }
 }

The startTempoTracking method should be called when the app is in the foreground. For more information refer to Location modules should be started from the foreground

Receiving Tempo events

The Tempo service does not issue events under normal operation. Instead, it only issues events if there is an issue with the operation. Tracking events are instead delivered via webhook, as configured in the Canvas UI.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    BDLocationManager.instance()?.tempoTrackingDelegate = self
    BDLocationManager.instance()?.initialize(
       withProjectId: "MyProjectId"){ error in
          guard error == nil else {
             print("Initialisation with Bluedot SDK failed \(error.localizedDescription)")
             return
          }
    }
    return true
}
extension AppDelegate: BDPTempoTrackingDelegate {
    func didStopTrackingWithError(_ error: Error!) {
       print("There was an error continuing to track with the Bluedot SDK: \(error.localizedDescription)") 
    }
}

Stop Tempo

If you only need tempo for a limited period, once that period is over, you can stop the tempo service.

BDLocationManager.instance()?.stopTempoTracking(){ error in
     guard error == nil else {
        print("Stop Tempo failed \(error.localizedDescription)")
        return
     }
 }
Created by Melwin Chiramel on December 21, 2020