Basic integration

This guide will help you setup the Cordova plugin in your application and configure it to be controlled via REST APIs. The plugin is built on top of native iOS and Android SDKs, which collect locations and related data in a battery efficient way. The module exposes methods to start and stop data collection, and interact with the HyperTrack APIs.

If you're looking for an example integration, use the example-cordova application.

[info] Requirements

The plugin requires Cordova version 6.4.0. Verify your version and update it to 6.4.0+ if required before installing the plugin.

$ cordova --version
$ npm install -g cordova

Install the dependency

In your project directory, install and link the module package using the Cordova CLI tool.

$ cordova plugin add cordova-plugin-hypertrack

Configure API key

In your app's config.xml set a new preference key HYPERTRACK_PK with your publishable key as the value. This key will be used by the native SDKs.

<preference name="HYPERTRACK_PK" value="pk_12345abcde" />

Connect the SDK

Initialise the SDK connection to the server by passing the driver id to the connectDriver method.

[info] Driver required

If you don't have a driver id, refer to creating a Driver.

var hypertrack = cordova.plugins.HyperTrack;

    // success callback
    function(response) { console.log(response); },
    // error callback
    function(error) { console.log(error); }

Once the SDK has been connected, it is ready to be controlled by the REST APIs.

results matching ""

    No results matching ""