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 lookup_id.
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.
startTracking Call this method to startTracking the user.
stopTracking Call this method to stopTracking the user.
isTracking Call this method to check if the user is active currently i.e. SDK is active for the configured user.
startMockTracking Call this method to start a simulation from your current location to a nearby location for the configured user.
stopMockTracking Call this method to stop a simulation.
isMockTracking Call this method to check if simulation is on for the configured user.
createAndAssignAction Call this method to assign and assign an Action to the current user.
assignActions Call this method to assign actions to the current user.
isActionTrackable Call this method to check whether given Action is trackable or not.
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)
getActionsForLookupId Call this method to get List of Actions for a given lookUpID
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.
trackActionByLookupId Call this method to track actions with a given lookupId 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
completeActionWithLookupId Call this method to mark an Action complete using Action's lookup id
completeActionInSync Call this method to mark an Action complete synchronously with HyperTrack Server
completeActionWithLookupIdInSync Method to mark an Action complete synchronously with HyperTrack Server using the Action's lookupId.
completeActionAndStopTrackingIfNoPendingAction Call this method to mark an Action complete and stopTracking if no pending actions for this user.
cancelAction Call this method to cancel an Action
cancelActionWithLookupId Call this method to cancel an Action using the Action's lookupId
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.
setUserId Call this method to set UserID in HyperTrack SDK for the current user.
getUserId Call this method to get currently configured UserID.
getUser Call this method to get User Object configures with device.
getUsersForLookupId Call this method to get user for a given lookup id.
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 lookup_id.

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

public static void getOrCreateUser(@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
lookupId 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
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)
                .setLookupId(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
lookupId 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 startTracking

Call this method to startTracking the user.

public static void startTracking();
public static void startTracking(@Nullable HyperTrackCallback callback);
Parameter Description
callback Pass instance of HyperTrack callback as parameter
void stopTracking

Call this method to stopTracking the user.

public static void stopTracking()
public static void stopTracking(@Nullable HyperTrackCallback callback)
Parameter Description
callback Pass instance of HyperTrack callback as parameter
boolean isTracking

Check if the user is active currently i.e. SDK is active for the configured user.

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

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

public static void startMockTracking(@Nullable HyperTrackCallback callback);
public static void startMockTracking(@NonNull LatLng sourceLatLng, @Nullable HyperTrackCallback callback);
public static void startMockTracking(@NonNull LatLng sourceLatLng, @NonNull LatLng destinationLatLng, @Nullable HyperTrackCallback callback);
Parameter Description
callback Pass instance of HyperTrack callback as parameter
sourceLatLng LatLng from which simulation will starts
destinationLatLng LatLng to which simulation will go
void stopMockTracking

Call this method to stop the simulation of user movement.

public static void stopMockTracking()
public static void stopMockTracking(@Nullable HyperTrackCallback callback)
Parameter Description
callback Pass instance of HyperTrack callback as parameter
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 createAndAssignAction

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

public static void createAndAssignAction(@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 assignActions

Call this method to assign list of actions to the current user.

public static void assignActions(@Nullable List<String> actionIds, @NonNull HyperTrackCallback callback);
Parameter Description
actionIds Pass a List of ActionIds to be assigned for the current user
callback Pass instance of HyperTrack callback as parameter
boolean isActionTrackable

Call this method to check whether given Action is trackable or not.

Returns true, if action is assigned to the user and assigned user's location is enabled and connected to internet otherwise, false.

public static boolean isActionTrackable(@NonNull Action action);
Parameter Description
Action Pass The action for which it is to be checked
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 getActionsForLookupId

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

public static void getActionsForLookupId(@NonNull String lookUpId, @Nullable String actionType, @NonNull HyperTrackCallback callback);
Parameter Description
lookUpId 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 trackActionsForUser

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

public static void trackActionsForUser(List<String> actionIds, @NonNull final HyperTrackCallback callback)

[warning] Deprecated

Use trackAction.

Parameter Description
actionIds List of ActionIds assigned to one user (casted as String)
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 trackActionByLookupId

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

public static void trackActionByLookupId(@NonNull String lookupId, @NonNull final HyperTrackCallback callback)
Parameter Description
lookupId LookupId 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 track a list of Actions on HyperTrackMapFragment which is embedded in your activity.

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 completeActionWithLookupId

Call this method to mark an Action complete using the Action's lookupId. 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 completeActionWithLookupId(@NonNull String lookupId)
Parameter Description
lookupId Pass the lookupId 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 completeActionWithLookupIdInSync

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

[info] Synchronous?

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

public static void completeActionWithLookupIdInSync(@NonNull String lookupId, @NonNull HyperTrackCallback callback)
Parameter Description
lookupId Pass the action's lookupId used while creating action
callback Pass instance of HyperTrack callback as parameter
void completeActionAndStopTrackingIfNoPendingAction

Call this method to mark an Action complete and stopTracking if no pending actions for this user.

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

Call this method to cancel an Action.

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

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

public static void cancelActionWithLookupId(@NonNull String lookupId, @Nullable HyperTrackCallback callback) {
Parameter Description
lookupId Pass the action's lookupId 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.
void setUserId

Call this method to set UserID in HyperTrack SDK for the current user. Refer to the documentation on creating a user.

public static void setUserId(@NonNull final String userID)
Parameter Description
userID Pass your user's unique id generated from HyperTrack Server as parameter.
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
void getUsersForLookupId

Call this method to get user for a given lookup id (lookup id used while creating a user on HyperTrack).

public static void getUsersForLookupId(@NonNull final String lookupId, @NonNull final HyperTrackCallback callback)
Parameter Description
lookupId Pass the lookupId used while creating user.
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 ""