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.
createUser Call this method to create a User on HyperTrack API Server for the current device.
getOrCreateUser Call this method to get or create a User on HyperTrack API Server for the current device with given lookup_id.
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.
createAndAssignAction Call this method to create and assign an Action to the current 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)
getActionsForLookupId Call this method to get List of Actions for a given lookUpID
trackActionsForUser Call this method to track a list of Actions assigned to one user on HyperTrackMapFragment which is embedded in your activity.
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.
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
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
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.
enableDebugLogging Call this method to enable or disable debug logging using Log Level.
enableMockLocations Call this method to enable or disable Mock locations. Mock Locations are DISABLED by default in the SDK.
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
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 createUser

Call this method to create a User on HyperTrack API Server for the current device.

public static void createUser(@Nullable HyperTrackCallback callback);
public static void createUser(String userName, @Nullable HyperTrackCallback callback);
public static void createUser(String userName, String phone, @Nullable HyperTrackCallback callback);
public static void createUser(String userName, String phone, String lookupId, @Nullable HyperTrackCallback callback);
Parameter Description
userName Name of the user
phone E164 formatted phone number of the user
lookupId A unique id that you can add to the user to search
callback Instance of HyperTrack callback as parameter

void getOrCreateUser

Call this method to get or create a User on HyperTrack API Server for the current device with given lookup_id. Refer to the documentation on creating a user.

public static void getOrCreateUser(String userName, String phone, String lookupId, @Nullable HyperTrackCallback callback);
Parameter Description
userName Name of the user
phone E164 formatted phone number of the user
lookupId A unique id that you can add to the user to search
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);
Parameter Description
activity Pass instance of the activity where permission needs to be requested.

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 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 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 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 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 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 enableDebugLogging

Used to enable or disable debug logging using Log Level. Defaults to Log.WARN if not specified.

public static void enableDebugLogging(int logLevel)
Parameter Description
logLevel Specify the log level to be enabled. One of Log.ASSERT, Log.VERBOSE, Log.DEBUG, Log.INFO, Log.WARN, Log.ERROR

void enableMockLocations

Used to enable or disable Mock locations. Mock Locations are DISABLED by default in the SDK.

public static void enableMockLocations(boolean enableMockLocations)
Parameter Description
enableMockLocations Boolean to indicate whether to enable/disable Mock Locations.

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 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
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.

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""