Utility Methods

Set DeviceToken

The GeoSpark SDK is capable of sending push notifications to your users. Check here to get the device token.

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

Check Location Permission

Check whether your app has location permission.


Location Permission Status

By using the locationPermissionStatus method you can check the location permission status.


notDetermined = 0

restricted = 1

denied = 2

authorizedAlways = 3

authorizedWhenInUse = 4

Request Location Permission

Check whether your App has location permission.


Check Location Tracking

Check whether location tracking is started or not. This method returns a boolean value.


Current Location

Get the current location of the user. You can set the accuracy between 5 to 100 meters (default is 10).

GeoSpark.getCurrentLocation(accuracy) { (location, error) in
// error?.code
// error?.message

Update Current Location

Using the updateCurrentLocation method, you can update user current location. You can set the accuracy between 5 to 100 meters (default is 10).


This method should be used only if you need to update the current location of the device with better accuracy. Using this method consistently will consume more battery. The higher the accuracy the longer the response time time. In some cases it could take up to 30 seconds depending on the GPS signal strength.

Notification Opened Handler

By using this method inside the Notification delegate method you can track the campaign's impressions and counts.

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)