To install the GeoSpark iOS SDK simply follow the following two steps:

  1. Download the SDK
  2. Import & Initialize SDK

Import and Initialize SDK into your project

After downloading the SDK, unzip and drag the GeoSpark.framework file into your project. Make sure it is included in your "Link Binary With Libraries" section of your target's Build Phases.

In your application delegate import the sdk. To initialize the SDK, you must call the GeoSpark.initialize method when your app is started.

  Import GeoSpark

  GeoSpark.sharedInstance.initialize("YOUR-SDK-KEY",apiSecret:"YOUR-SECRET",application: application);

Request for SDK keys if you don't have already.

Capabilities and permissions

Go to the capabilities tab in your app settings, scroll to background modes and switch it on. Select Location updates, Background fetch and Remote notifications.

To add permission strings to your Info.plist, go to the Info tab in your app settings and add permission strings for

  Privacy - Location Always Usage Description
  Privacy - Location Always and When In Use Usage Description
  Privacy - Location When In Use Usage Description

APNS Configurations

  1. Log into the GeoSpark dashboard, and open your Settings->Add Certs. Upload your APNS development or distribution certificates (.p12 files).
  2. In the app capabilities, ensure that remote notifications inside background modes is enabled.
  3. The following changes inside AppDelegate will register the SDK for push notifications and route GeoSpark notifications to the SDK.

Inside didFinishLaunchingWithOptions, use the SDK method to register for notifications.

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {

  func getNotificationSettings() {
     UNUserNotificationCenter.current().getNotificationSettings { (settings) in
        guard settings.authorizationStatus == .authorized else { return }
        DispatchQueue.main.async {

  func registerForPushNotifications() {
     UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
     (granted, error) in
        guard granted else { return }
        UNUserNotificationCenter.current().delegate = self

Inside and didRegisterForRemoteNotificationsWithDeviceToken and didFailToRegisterForRemoteNotificationsWithError methods, add the relevant lines so that GeoSpark can register the device token.

  func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
      let tokenParts = { data -> String in
            return String(format: "%02.2hhx", data)
        let deviceToken = tokenParts.joined()

  func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {

Inside the didReceiveRemoteNotification method, add the GeoSpark receiver. This method parses only the notifications that sent from GeoSpark.

  func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {

      // Do any additional handling for your app's notifications.

Create User

The SDK needs an User ID object to identify the device. The SDK has a convenience method createUser() to create a user which returns User ID.

  //Create a User for given deviceToken on GeoSpark Server. 
  GeoSpark.sharedInstance.createUser{(success, error, userID) in
      if (error != nil) {
          // Handle createUser API error here

      if (userId != nil) {
          // Handle createUser API success here

Get User

If you already have an User ID object. The SDK has a convenience method getUser() to to start the session for the existing user.

Method parameters
Parameter Description
userID User ID from your API Server

  *Implement your API call for User Login and get back a GeoSpark
  *UserId from your API Server to be configured in the GeoSpark SDK
  *along with deviceToken.

  GeoSpark.sharedInstance.startSessionForUser(userID, completion : {(success, error, userID) in
      if (error != nil) {
          // Handle getUser API error here

      if (userId != nil) {
          // Handle getUser API success here


Start Location Tracking

To start tracking the location, use the startLocationTracking() method. You can keep SDK to track location, or turn it off if you want to stop tracking the user at any point of time using the stopLocationTracking() method.


Stop Location Tracking

You can stop tracking the user at any point of time using the stopLocationTracking() method.


View Dashboard

Install your app with the GeoSpark SDK on a device and begin tracking on the Dashboard. You would see the user’s current state on the GeoSpark dashboard. If you click on the user, you should be able to view the user's location history.