Basic integration

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

In case you are not using React Native, you can refer to the Android version, or the iOS version.

[info] Step-By-Step Onboarding

Integrating HyperTrack React Native SDK in your app?

We recommend you try our new interactive step-by-step onboarding

React Native Onboarding

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: View dashboard

Install your app with the HyperTrack SDK on a device and begin tracking on the Dashboard. You would see the user’s current state on the HyperTrack dashboard. If you click on the user, you should be able to view the user's trips and stops.

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);
    }
);

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""