Using Actions

An Action represents a pickup, delivery, visit or any other transaction event being performed by the User. In this guide, we will cover how to complete actions on the SDK.

Step 1: Start the SDK

To start tracking the user, use the startTracking method.


Step 2: Assigning Actions to a User

Create and assign an Action object with the user id to start. You can refer to the Action model for more options. Action ends when it is marked complete using the completeAction API.

// Construct a place object which will be associated with the Action.
let place: HyperTrackPlace = HyperTrackPlace(id: UUID().uuidString,
    name: "The place to be",
    location: HTGeoJSONLocation(type: "point", coordinates: CLLocationCoordinate2D(latitude: 28.5621847, longitude: 77.1594093)),
    address: "Vasant Vihar",
    landmark: "",
    zipCode: "110057",
    city: "New Delhi",
    state: "Delhi",
    country: "India")

// Creat an Action with the place object just created.
HyperTrack.assignAction(place.toDict(), "visit") { action, error in
    if let error = error {
        // Handle error
    if let action = action {
        let actionID =    // Use this actionID to query the stats of the action later.

Step 3: Fetch Action details

Call getAction API to fetch action details for a given action id from HyperTrack Server.

let action = HyperTrack.getAction("ACTION_ID") { action, error in
    if let error = error {
    if let action = action {
        // Use Action entity properties.
        let distanceTravelled = action.distance

Step 4: Completing an Action

Call completeAction API to mark an action completed.


Step 5: Stop the SDK

To stop tracking the user, use the stopTracking method.


Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""