Self-Managed Integration

Once the SDK is initialised, you can start tracking locations and use the data locally on your device or send it directly to your own backend server.

Location Tracking

Once the tracking mode is configured, use the below code to start tracking.

GeoSpark.startSelfTracking(trackingMode)

You may see a delay if the user's device is in low power mode or has connectivity issues.

To listen to location updates create a class that implements GeoSparkDelegate and then call GeoSpark.delegate. Set your GeoSparkDelegate in a code path that will be initialized and executed in the background. For example, make your AppDelegate implement GeoSparkDelegate, not a ViewController. AppDelegate will be initialized in the background, whereas a ViewController may not be.

class AppDelegate: UIResponder,UIApplicationDelegate,GeoSparkDelegate{
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey:
Any]?) -> Bool {
GeoSpark.initialize("YOUR SDK KEY GOES HERE")
GeoSpark.delegate = self
return true
}
func didUpdateLocation(_ geospark: GeoSparkLocation) {
//receive own location updates here
//do something with location data using location
}
}

To stop the tracking use the below method.

GeoSpark.stopSelfTracking()

Location Tracker

Location update payload objects that you will receive with the location tracker:

Key

Type

Description

latitude

Float

Geographic coordinate north-south

longitude

Float

Geographic coordinate west-east

speed

Float

Speed in kilometers per hour (only in motion)

altitude

Float

Height above the sea level in meters

horizontal_accuracy

Float

Horizontal accuracy of the coordinates

vertical_accuracy

Float

Vertical accuracy of the coordinates

activity

String

Is the user moving or did they stop?

recorded_at

Datetime

Location recorded at timestamp in UTC

tz_offset

String

Location recorded at timezone