iOS-Integration

Location:

Start Location Tracking

You can start tracking the user location by using startTracking() method.

                                
  GeoSpark.startTracking()
  [GeoSpark startTracking];  
                               
                            

Stop Location Tracking

You can end/stop tracking the user location by using stopTracking() method.

                                
  GeoSpark.stopTracking()
  [GeoSpark stopTracking];  
                               
                            

Location listener

Implement GeoSparkDelegate in AppDelegate , that will be initialized and executed in the background.

                                
  GeoSpark.delegate = self
  [GeoSpark setDelegate:self];  
                               
                            

Trip:

Start Trip

Once user start tracking location , you can use startTrip method.

                                
  GeoSpark.startTrip("Trip Description",{ (trip) in
         // Trip id , start time
         // trip.tripId
         //trip.trip_started_at
         }, onFailure: { (error) in
           // error.errorCode
           // error.errorMessage
   })
  [GeoSpark startTrip:@"Trip Description" :^(GeoSparkTrip * trip) {
         // Trip id , start time
         //trip.tripId
         //trip.trip_started_at
      } onFailure:^(GeoSparkError * error) {
         // error.errorCode
         // error.errorMessage
    }];
                               
                            

End Trip

Once the trip started , you can stop the trip using TRIPID

                                
   GeoSpark.endTrip("TRIPID", { (trip) in
           // Trip id , ended time
           // trip.tripId
           // trip.trip_ended_at
        }, onFailure: { (error) in
             // error.errorCode
             // error.errorMessage
     })
   [GeoSpark endTrip:@"TRIPID" :^(GeoSparkTrip * trip) {
           // Trip id , ended time
           // trip.tripId
           // trip.trip_ended_at
     } onFailure:^(GeoSparkError * error) {
             // error.errorCode
             // error.errorMessage
     }];
                               
                            

Active Trips

By using activeTrips method you can see active trips of the user.

                                
  GeoSpark.activeTrips({ (trips) in
       // List of tripid, started time
       // trips.data[0].tripId
       // trips.data[0].tripStartedAt
      }, onFailure: { (trips) in
             // error.errorCode
             // error.errorMessage
    })
  [GeoSpark activeTrips:^(GeoSparkTrips * trips) {
         // List of tripid, started time
         // trips.data[0].tripId
         // trips.data[0].tripStartedAt
        } onFailure:^(GeoSparkError * error) {
               // error.errorCode
               // error.errorMessage
     }];;
                               
                            

Geofence:

Create Geofence

Create Geofence in GeoSpark SDK, using createGeofence() method.

Make sure radius should be (50 -1000 meters) and set expiry time less than 24hrs.

                                
  GeoSpark.createGeofence(latitude: latitude, longitude: logitude, expiry:
  expiry, radius: radius, { (geofence) in
             // geofence.create_at
             // geofence.expire_at
             // geofence.geofence_id
             // geofence.geometry_radius
             // geofence.coordinate
        }, onFailure: { (error) in
             // error.errorCode
             // error.errorMessage
        })
  [GeoSpark createGeofenceWithLatitude:latitude longitude:longitude
  expiry:expiry radius:radius :^(GeoSparkGeofence * geofence) {
             // geofence.create_at
             // geofence.expire_at
             // geofence.geofence_id
             // geofence.geometry_radius
             // geofence.coordinate
        } onFailure:^(GeoSparkError * error) {
             // error.errorCode
             // error.errorMessage
        }];
                               
                            

Geofence List

Retrieve list of geofences created by the user using this geofenceList

                                
  GeoSpark.geofenceList({ (geofenceLists) in
          //geofenceList.data.count
        }, onFailure: { (error) in
               // error.errorCode
               // error.errorMessage
  })
  [GeoSpark geofenceList:^(GeoSparkGeofenceList * geofenceList) {
          //geofenceList.data.count
        } onFailure:^(GeoSparkError * error) {
               // error.errorCode
               // error.errorMessage
  }];
                               
                            

Delete Geofence

You can delete geofence by using deleteGeofence method.

                                
  GeoSpark.deleteGeofence("GEOFENCE_ID", { (message) in
        // message
        }) { (error) in
        // error.errorCode
        // error.errorMessage
  }
  [GeoSpark deleteGeofence:@"GEOFENCE_ID" :^(NSString * message) {
         // message
    } onFailure:^(GeoSparkError * error) {
         // error.errorCode
        // error.errorMessage
  }];
                               
                            

User:

Update user Description

This will help to add a description to the user so that it is easier for you to identify your users, while tracking them in SDK. And our SDKs provide you with the option to modify the description any time for a user. This can help you easily identify users on dashboard simply via the description.