Basic integration

Once the module has been installed and you have configured your publishable token, you can use the methods of the SDK.

Step 1: Define a user

To be able to identify the device, the SDK needs a user id. You can create a new user user on the SDK, and specify a string identifier. This is a network call that requires the device to be online.

[info] User already created?

You can set an existing user id, in case you have created an user id via the backend API using the RNHyperTrack.setUserId("YOUR_USER_ID") method in the SDK.

RNHyperTrack.createUser("User name",
    (success) => {
        // success callback
        console.log(success);
    }, (error) => {
        // error callback
        console.log(error);
    }
);

Step 2: Start tracking

Once the user id has been defined, the SDK can start tracking. Use the startTracking method to enable the SDK for tracking. You can use the callback methods to confirm tracking is working, or use the isTracking method.

RNHyperTrack.startTracking(
    (success) => {
        // success callback
        console.log(success);
    }, (error) => {
        // error callback
        console.log(error);
    }
);

Step 3: Complete actions

While the SDK is active, you can complete an action from the SDK. Pass the action id to complete an action. This can also be done offline, and the time and location of the call will be queued in the device till it can be sent to the server.

[info] Actions

Actions are important business events that you can assign to users and mark as completed. Read more about Actions.

// complete the action, given action id
RNHyperTrack.startTracking("77b9a3fa-a3ab-4840-aadb-cd33442ca45b");

Step 4: Stop tracking

When you want to disable the SDK and stop tracking, call the stopTracking method. You can confirm the SDK is inactive by checking the callback methods.

RNHyperTrack.stopTracking(
    (success) => {
        // success callback
        console.log(success);
    }, (error) => {
        // error callback
        console.log(error);
    }
);

results matching ""

    No results matching ""