The User object represents the user who is being tracked. The identifier of the user is used in the SDK to identify the tracking device.

The User object

Method Type Description
getId uuid String Unique identifier for the object
getName String Name of the user
getPhone String Phone number of user
getGroupId String The id of the fleet to which this user belongs
getLookupId String A unique id that was added to the user to identify
getAvailabilityStatus String The availability status of the user, possible values are USER_STATUS_ONLINE, USER_STATUS_OFFLINE and USER_STATUS_ACTIVE
getPendingActions List<Action> List of action ids that have been assigned to the user and are not complete
getLastLocation HyperTrackLocation Last Location of user as HyperTrackLocation object
getLastHeartbeatAt Date Date time for last communication with the user's device
getLastOnlineAt Date Date time when the last tracking session was started for the user
getCreatedAt Date Timestamp of when user was created
getModifiedAt Date Timestamp of when user detail was last modified
isConnected boolean Is user device connected with HyperTrackServer

[info] isConnected? TRUE or FALSE

Connected Status Description
TRUE When the user's device is connected to internet along with SDK is able to send data to server.
FALSE When the user's device doesn't connected to internet OR Connected to internet but SDK is crashed or not able to push data to server.

Availability statuses

Availability status Description
USER_STATUS_ONLINE When the user's session has been started with startTracking on the SDK
USER_STATUS_OFFLINE When the user's session has been ended by stopTracking on the SDK
USER_STATUS_ACTIVE When the user has been assigned one or more Action - once the actions are completed, the user goes back to online

Create a User

To be able to identify the device, the SDK needs a user id. You can create a new user user on the SDK, and specify a string identifier. This is a network call that requires the device to be online. This will configure the SDK with this user id. The User object is returned in HyperTrackCallback's response if specified.

[info] User already created?

You can set an existing user id, in case you have created an user id via the backend API using the HyperTrack.setUserId("YOUR_USER_ID") method in the SDK.

API signature Description
createUser(HyperTrackCallback callback) Creates a HyperTrack UserId with a user name based on the device
createUser(String userName, HyperTrackCallback callback) Creates a HyperTrack UserId with the given user name and returns the User object via callback
createUser(String userName, String phone, HyperTrackCallback callback) Creates a HyperTrack UserId with the given user name & phone no
createUser(String userName, String phone, String lookupId, HyperTrackCallback callback) Creates a HyperTrack UserId with the given user name, phone no & lookupId
// createUser API with lookup_id param will create a new user only if none exists already for the given lookup_id.
HyperTrack.createUser(userName, phone, lookupId, new HyperTrackCallback() {
   public void onSuccess(@NonNull SuccessResponse response) {
       if (response.getResponseObject() != null) {
            User user = (User) response.getResponseObject();
            String userId = user.getId();
            // Handle user_id, if needed

   public void onError(@NonNull ErrorResponse error) {
       // Handle createUser error here
       Toast.makeText(this, error.getErrorMessage(), Toast.LENGTH_SHORT).show();

Get UserId

Call HyperTrack.getUserId() API to get UserId configured in the SDK casted as a String.

String userId = HyperTrack.getUserId();

Get Users for a LookupId

Returns a user object for a given lookup_id parameter.

HyperTrack.getUsersForLookupId(lookupId, new HyperTrackCallback() {
  public void onSuccess(@NonNull SuccessResponse response) {
    // Handle getUsersForLookupId response here   
    if (response.getResponseObject() != null) {
      List<User> users = (List<User>) response.getResponseObject();

  public void onError(@NonNull ErrorResponse errorResponse) {
    // Handle getUsersForLookupId error

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""