Method reference

The Cordova has methods for some commonly used methods in the native SDKs. Methods do not return anything, and use callback functions to return objects and method results.

Example implementation

Initialise with your key

var app = {
    // Application Constructor
  initialize: function() {
      document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
    },

  // deviceready Event Handler
  //
  // Bind any cordova events here. Common events are:
  // 'pause', 'resume', etc.
  onDeviceReady: function() {
      this.receivedEvent('deviceready');

    var hypertrack = cordova.plugins.HyperTrack;
    hypertrack.getOrCreateUser("name", "phone", "lookup", 
        (e) => {
          console.log('getOrCreateUser success', e);
      },
      (e) => {
          console.log('getOrCreateUser error', e);
      });
  }

  ...
};

app.initialize();

Methods

Name Parameters Description
getOrCreateUser name: string, phone: string, , lookupId: string, success: method, error: method Create a new user to identify the current device
setUserId userId: string, success: method, error: method Set UserId for the SDK created using HyperTrack APIs
startTracking success: method, error: method Enable the SDK and start tracking
createAndAssignAction type: string, lookupId: string, expectedPlaceAddress: string, expectedPlaceLatitude: string, expectedPlaceLongitude: string,success: method, error: method Create and assign an action to the current user using specified parameters
completeAction actionId: string, success: method, error: method Complete an action from the SDK
completeActionWithLookupId lookupId: string, success: method, error: method Complete an action from the SDK using Action's lookupId as parameter
stopTracking success: method, error: method Disable the SDK and stop tracking
getCurrentLocation success: method, error: method Get user's current location from the SDK
checkLocationPermission success: method, error: method Check if Location permission has been granted to the app. Returns "true" or "false" in success method accordingly.
requestPermissions success: method, error: method Request user to grant Location access to the app.
checkLocationServices success: method, error: method Check if Location services are enabled on the device. Returns "true" or "false" in success method accordingly.
requestLocationServices success: method, error: method Request user to enable Location services on the device.

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""