HyperTrack Class Method Reference

HyperTrack class defines a set of API methods.

Summary

Method Description
initialize Call this method to initialize HyperTrack SDKs with your Account's PublishableKey
setCallback Call this method to set a HyperTrackEventCallback.
setgnssstatuscallback Call this method to set a GnssStatus.Callback.
getOrCreateUser Call this method to get or create a User on HyperTrack API Server for the current device with given UniqueId.
updateUser Call this method to update a User's details on HyperTrack API Server for the current user id configured on the sdk.
checkLocationPermission Call this method to check whether the user has granted location permission for the app.
requestPermissions Call this method to request Location permission to power HyperTrack SDK.
checkLocationServices Call this method to check whether the Location Services are currently enabled or not.
requestLocationServices Call this method to request user to enable Location Services to power HyperTrack SDK.
getCurrentLocation Call this method to fetch user's current location.
pauseTracking Call this method to pause tracking user movement.
resumeTracking Call this method to resume tracking user movement. This method only work when there is any active action.
isTracking Call this method to check if the user is active currently i.e. there are pending action for a configured user.
createMockAction Call this method to start a simulation from your current location to a nearby location for the configured user by creating an action.
completeMockAction Call this method to complete an action and stop simulation.
isMockTracking Call this method to check if simulation is on for the configured user.
createAction Call this method to create an Action to the configured user.
getAction Call this method to get Action model for a given actionId
getActionForShortCode Call this method to get Action model for a given shortCode (unique code in Action's trackingUrl)
getActionsForUniqueId Call this method to get List of Actions for a given unique Id
trackAction Call this method to track a list of Actions on HyperTrackMapFragment which is embedded in your activity.
trackActionByShortCode Call this method to track Actions given a list of ShortCodes on HyperTrackMapFragment which is embedded in your activity.
trackActionByUniqueId Call this method to track actions with a given unique on HyperTrackMapFragment which is embedded in your activity.
trackActionByCollectionId Call this method to track actions with a given collectionId on HyperTrackMapFragment which is embedded in your activity.
removeActions Call this method to remove Actions from HyperTrackMapFragment. Removes all tracked actions if actionIds is NULL.
completeAction Call this method to mark an Action complete
completeActionWithUniqueId Call this method to mark an Action complete using Action's unique id
completeActionInSync Call this method to mark an Action complete synchronously with HyperTrack Server
completeActionWithUniqueIdInSync Method to mark an Action complete synchronously with HyperTrack Server using the Action's uniqueId.
setServiceNotificationParams Call this method to sets the Foreground Service Notification Params as specified.
clearServiceNotificationParams Call this method to clears the Foreground Service Notification Params, if any exists.
getPublishableKey Call this method to get the PublishableKey configured in the SDK currently.
getUserId Call this method to get currently configured UserID.
getUser Call this method to get User Object configures with device.
getSDKVersion Call this method to get current SDK VersionName
setSDKPlatform Call this method to set OS Platform for the SDK or the wrapper
getSDKPlatform Call this method to get configured OS Platform for the current SDK

Constants

public static final int REQUEST_CODE_LOCATION_PERMISSION = 0;
public static final int REQUEST_CODE_LOCATION_SERVICES = 1;

Public Methods

void initialize

Call this method to initialize HyperTrack SDKs with your Account's PublishableKey in the onCreate method of either your Application file or your app's Launcher activity. Refer to the HyperTrack API key.

public static void initialize(@NonNull Context context, @NonNull String publishableKey);
Parameter Description
context Pass your Application's context as the first parameter
publishableKey Pass your account's PublishableKey as the second parameter
void setCallback

Call this method to set a HyperTrackEventCallback. This callback allows you to receive events and errors happening in the HyperTrackSDK as they occur.

public static void setCallback(@NonNull HyperTrackEventCallback callback);
Parameter Description
callback Instance of HyperTrackEventCallback object which will be invoked on an Event or an error.
void setgnssstatuscallback

Call this method to set a GnssStatus.Callback. This callback allows you to receive GNSS status updates happening while the user is currently being tracked.

public static void setgnssstatuscallback(@NonNull GnssStatus.Callback callback);
Parameter Description
callback Instance of GnssStatus. Callback object which will be invoked on a GNSSStatus update.
void getOrCreateUser

Call this method to get or create a User on HyperTrack API Server for the current device with given unique Id.

UserParams userParams = new UserParams().setName(name)
                .setPhone(phoneNumber)
                .setPhoto(encodedImage)
                .setUniqueId(phoneNumber)
                .setGroupId(groupId);

public static void getOrCreateUser(@Nullable UserParams userParams, @Nullable HyperTrackCallback callback);

Note: If you have the hypertrack create user Id then create user params and call only setId method. If any other params is pass along with user-id then all other params except user-id will get ignores.

UserParams userParams = new UserParams().setId(<hypertrack-user-id>);

public static void getOrCreateUser(@Nullable UserParams userParams, @Nullable HyperTrackCallback callback);
Parameter Description
userParams Builder Class for list of user params
callback Instance of HyperTrack callback as parameter
void updateUser

Call this method to update a User's details on HyperTrack API Server for the current user id configured on the sdk.

UserParams userParams = new UserParams().setName(name)
                .setPhone(phoneNumber)
                .setPhoto(encodedImage)
                .setUniqueId(phoneNumber)
                .setGroupId(groupId);

public static void updateUser(@Nullable UserParams userParams, @Nullable HyperTrackCallback callback);
Parameter Description
userName Name of the user
phone E164 formatted phone number of the user
photo Base64 string of user image file OR URL of image
uniqueId A unique id that you can add to the user to search
groupId A unique id of the group created using HyperTrack API server
callback Instance of HyperTrack callback as parameter
boolean checkLocationPermission

Call this method to check whether the user has granted location permission for the app.

public static boolean checkLocationPermission(Context context);
Return Description
boolean Returns true if the location permission has been granted or not required, false otherwise.
Parameter Description
context Pass your Application's context
void requestPermissions

Call this method to request Location permission to power HyperTrack SDK.

public static void requestPermissions(@NonNull Activity activity);
public static void requestPermissions(@NonNull Activity activity, String title, String message)
Parameter Description
activity Pass instance of the activity where permission needs to be requested.
title Pass string to set as dialog's title.
message Pass string as custom rationale message, default message will be For a more customized and enhanced in-app experience, please allow this app to access your device’s location.
boolean checkLocationServices

Call this method to check whether the Location Services are currently enabled or not.

public static boolean checkLocationServices(Context context)
Return Description
boolean Returns true if the location services are enabled in HIGH_ACCURACY mode, false otherwise.
Parameter Description
context Pass your Application's context
void requestLocationServices

Call this method to request user to enable Location Services to power HyperTrack SDK.

public static void requestLocationServices(@NonNull AppCompatActivity activity, HyperTrackCallback callback);
Parameter Description
activity Pass instance of the AppCompatActivity where location services needs to be enabled.
callback Pass instance of HyperTrack callback as parameter.
void getCurrentLocation

Call this method to fetch user's current location.

public static void getCurrentLocation(@NonNull HyperTrackCallback callback);
Parameter Description
callback Pass instance of HyperTrack callback as parameter
void pauseTracking

Call this method to pause tracking user's movement data. After the successful call of this method SDK stop generating any movement data from SDK and sending it to HyperTrack Server.

public static void pauseTracking();
void resumeTracking

Call this method to resumee tracking user's movement data. Tracking will only resume when there is some active actions for this particular user. pauseTracking must have called in the past before calling this method.

public static void resumeTracking(@Nullable HyperTrackCallback callback);
boolean isTracking

Check if the user is active currently i.e. User has some pending action.

public static boolean isTracking();
Return Description
boolean Returns true if the SDK is active for the configured user.
void createMockAction

Call this method to start the simulation of the user movement from current location or from the specified source location to specified destination location by creating an action.

public static void createMockAction(@NonNull ActionParams actionParams, @Nullable HyperTrackCallback callback);
public static void createMockAction(@NonNull ActionParams actionParams, @NonNull LatLng sourceLatLng, @Nullable HyperTrackCallback callback);
public static void createMockAction(@NonNull ActionParams actionParams, @NonNull LatLng sourceLatLng, @NonNull LatLng destinationLatLng, @Nullable HyperTrackCallback callback);
Parameter Description
actionParams Pass instance of ActionParams built using ActionParamsBuilder class
callback Pass instance of HyperTrack callback as parameter
sourceLatLng LatLng from which simulation will starts
destinationLatLng LatLng to which simulation will go
void completeMockAction

Call this method to stop the simulation of user movement by completing an action.

public static void completeMockAction(String actionId)
Parameter Description
actionId Pass the action's id generated on HyperTrack Server
boolean isMockTracking

Check if the simulation is active for the configured user.

public static boolean isMockTracking();
Return Description
boolean Returns true if the simulation is active for the configured user.
void createAction

Call this method to create an Action to the current user.

public static void createAction(@Nullable ActionParams actionParams, @NonNull HyperTrackCallback callback);
Parameter Description
actionParams Pass instance of ActionParams built using ActionParamsBuilder class
callback Pass instance of HyperTrack callback as parameter
void getAction

Call this method to get Action model for a given actionId

public static void getAction(@NonNull String actionId, @NonNull HyperTrackCallback callback);
Parameter Description
actionId Pass the action's unique id generated on HyperTrack API Server
callback Pass instance of HyperTrack callback as parameter
void getActionForShortCode

Call this method to get Action model for a given shortCode (unique code in Action's trackingUrl)

public static void getActionForShortCode(@NonNull String shortCode, @NonNull HyperTrackCallback callback);
Parameter Description
shortCode Pass the action's unique shortCode generated on HyperTrack API Server
callback Pass instance of HyperTrack callback as parameter
void getActionsForUniqueId

Call this method to get List of Actions for a given action's uniqueId.

public static void getActionsForUniqueId(@NonNull String uniqueId, @Nullable String actionType, @NonNull HyperTrackCallback callback);
Parameter Description
uniqueId Order ID or any internal Id that was used while creating an action
actionType The type of the actions, possible values are ACTION_TYPE_PICKUP, ACTION_TYPE_DELIVERY, ACTION_TYPE_DROPOFF, ACTION_TYPE_VISIT, ACTION_TYPE_STOPOVER, ACTION_TYPE_TASK
callback Pass instance of HyperTrack callback as parameter
void trackAction

Call this method to track a list of Actions on HyperTrackMapFragment which is embedded in your activity.

public static void trackAction(@NonNull List<String> actionIds, @NonNull final HyperTrackCallback callback)
Parameter Description
actionIds List of ActionIds to be tracked on the map (casted as List of Strings)
callback Pass instance of HyperTrack callback as parameter
void trackActionByShortCode

Call this method to track Actions given a list of ShortCodes on HyperTrackMapFragment which is embedded in your activity.

public static void trackActionByShortCode(@NonNull List<String> shortCodes, @NonNull final HyperTrackCallback callback)
Parameter Description
shortCodes List of ShortCodes from tracking urls of Actions to be tracked on the map (casted as List of Strings)
callback Pass instance of HyperTrack callback as parameter
void trackActionByUniqueId

Call this method to track actions with a given UniqueId on HyperTrackMapFragment which is embedded in your activity.

public static void trackActionByUniqueId(@NonNull String uniqueId, @NonNull final HyperTrackCallback callback)
Parameter Description
uniqueId UniqueId for Actions to be tracked on the map (casted as String)
callback Pass instance of HyperTrack callback as parameter
void trackActionByCollectionId

Call this method to track actions with a given collectionId on HyperTrackMapFragment which is embedded in your activity.

public static void trackActionByCollectionId(@NonNull String collectionId, @NonNull final HyperTrackCallback callback)
Parameter Description
collectionId collectionId for Actions to be tracked on the map (casted as String)
callback Pass instance of HyperTrack callback as parameter
void removeActions

Call this method to remove a list of Actions from tracking on HyperTrackMapFragment which is embedded in your activity/fragment.

Note If null is passed then all tracking action will be removed.

public static void removeActions(List<String> actionIds)
Parameter Description
actionIds List of ActionIds to be removed from tracking (casted as String)
void completeAction

Call this method to mark an Action complete

public static void completeAction(@NonNull String actionId)
Parameter Description
actionId Pass the action's unique id generated on HyperTrack Server
void completeActionWithUniqueId

Call this method to mark an Action complete using the Action's UniqueId. HyperTrackCallback.onSuccessResponse() returns a List<Action>.

[info]

This API is be a light weight method which marks the action complete locally and updates this on the HyperTrack Server at the best possible time. Calling this API ensures that action will be marked completed even if the device was offline at the time of API call.

public static void completeActionWithUniqueId(@NonNull String uniqueId)
Parameter Description
uniqueId Pass the UniqueId for the action generated on HyperTrack Server
void completeActionInSync

Call this method to mark an Action complete synchronously with HyperTrack Server.

[info] Synchronous?

This API will make an HTTP call and will not be retried later in case of a failure.

public static void completeActionInSync(@NonNull String actionId, @NonNull HyperTrackCallback callback)
Parameter Description
actionId Pass the action's unique id generated on HyperTrack Server
callback Pass instance of HyperTrack callback as parameter
void completeActionWithUniqueIdInSync

Call this method to mark an Action complete synchronously with HyperTrack Server using the Action's UniqueId.

[info] Synchronous?

This API will make an HTTP call and will not be retried later in case of a failure.

public static void completeActionWithUniqueIdInSync(@NonNull String uniqueId, @NonNull HyperTrackCallback callback)
Parameter Description
uniqueId Pass the action's UniqueId used while creating action
callback Pass instance of HyperTrack callback as parameter
void setServiceNotificationParams

Sets the Foreground Service Notification Params as specified.

public static boolean setServiceNotificationParams(final ServiceNotificationParams notificationParams)
Parameter Description
notificationParams NotificationParams object to be set.

[warning] Important These Params will be stored in Persistent Storage. So, in case of any change in the settings, they should be either reset explicitly or clearServiceNotificationParams() method should be called first.

void clearServiceNotificationParams

Clears the Foreground Service Notification Params, if any exists.

public static void clearServiceNotificationParams()
String getPublishableKey

Call this method to get the PublishableKey configured in the SDK currently.

public static String getPublishableKey(Context context)
Parameter Description
context Pass your Application's context
Return Description
String Returns a string containing the PublishableKey if configured, null otherwise.
String getUserId

Call this method to get currently configured UserID.

public static String getUserId()
Return Description
String Returns string containing the UserID if it is configured, null otherwise.
void getUser

Call this method to get User Object configured with device.

public static void getUser(@NonNull final HyperTrackCallback callback)
Parameter Description
callback Pass instance of HyperTrack callback as parameter
String getSDKVersion

Call this method to get current SDK VersionName.

public static String getSDKVersion();
Return Description
String Returns the VersionName for the SDK casted as a String.
void setSDKPlatform

Call this method to set OS Platform for the SDK or the wrapper (Ex: "ReactNative" for ReactNative wrapper)

public static void setSDKPlatform(String sdkPlatform)
Parameter Description
sdkPlatform String representing the current OS Platform
String getSDKPlatform

Call this method to get configured OS Platform for the current SDK.

public static String getSDKPlatform()
Return Description
String SDKPlatform as a String representing the configured OS Platform.

results matching ""

    No results matching ""