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) {GeoSpark.setDeviceToken(deviceToken)}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{[GeoSpark setDeviceToken:deviceToken];}
Check whether your app has location permission.
GeoSpark.isLocationEnabled()
[GeoSpark isLocationEnabled];
By using the locationPermissionStatus
method you can check the location permission status.
GeoSpark.locationPermissionStatus()
[GeoSpark locationPermissionStatus];
notDetermined = 0
restricted = 1
denied = 2
authorizedAlways = 3
authorizedWhenInUse = 4
Check whether your App has location permission.
GeoSpark.requestLocation()
[GeoSpark requestLocation];
Check whether location tracking is started or not. This method returns a boolean value.
GeoSpark.isLocationTracking()
[GeoSpark isLocationTracking];
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//location?.coordinate.latitude//location?.coordinate.longitude//location?.altitude// error?.code// error?.message}
[GeoSpark getCurrentLocation:<#(NSInteger)#> handler:^(CLLocation * location, GeoSparkError * error) {//location?.coordinate.latitude//location?.coordinate.longitude//location?.altitude// error?.code// error?.message}];
Using the updateCurrentLocation
method, you can update user current location. You can set the accuracy between 5 to 100 meters (default is 10).
GeoSpark.updateCurrentLocation(accuracy)
[GeoSpark updateCurrentLocation:accuracy];
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.
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){GeoSpark.notificationOpenedHandler(response)completionHandler()}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{[GeoSpark notificationOpenedHandler:response];}
GeoSpark.setTrackingInAppState(STATE)
[GeoSpark setTrackingInAppState:STATE];
Parameter | Description |
STATE | GeoSparkTrackingState.Foreground (or) GeoSparkTrackingState.Background (or) GeoSparkTrackingState.AlwaysOn |
GeoSpark.offlineLocationTracking(Bool)
[GeoSpark offlineLocationTracking];
Parameter | Description |
Bool | true (default) -- Offline location enabled. false -- Offline location disabled. |
For enabling accuracy engine for Passive, Active, and Balanced tracking
GeoSpark.enableAccuracyEngine()
For disabling accuracy engine
GeoSpark.disableAccuracyEngine()