ActiveCustomerActions Interface

login(token: String, secret: String, region: String, callback: ResultCallback)

Call this method once to authenticate the user with Bringg and to allow using the various capabilities such as changing task status and reporting location.


Obtaining token, secret and region params

The above params can be obtained by calling the following service:
"Generate Customer One Time Code". See reference: generate customer one-time code .

ResultCallback will be called with a LoginResult enum.
LoginResult.success() indicates if the user is successfully authenticated.

LoginResult Enum values:Description
SUCCESSuser authenticated successfully
FAILED_INVALID_CONFIGURATION_ERRORsystem configurations on Bringg platform prevent authenticating this user
FAILED_INVALID_USER_ERRORthis user can't be authenticated as a customer
FAILED_NETWORK_ERRORinternet connection error
FAILED_TO_LOGINBringg platform couldn't authenticate this user

startTask(id: Long, callback: ResultCallback)

Marks the user as online, and subsequently fetch user orders from Bringg, starts sharing locations and listens for status updates.
After the order is fetched successfully, active task live data events will start being fired with the updated order state and data (see registering-for-task-state-live-data)
The result of the action (success or failure with a reason) will be provided in the callback.


Battery Usage

Since the SDK is actively tracking user location when online, battery usage is higher than usual. Make sure that the user is online only when location tracking is needed.


Async Callback

Note that the startTask method has an async result callback because once you provide the id, it fetches and process the related task from Bringg servers, marking the user online and only starts it afterwards.

arriveToWaypoint(): TaskActionResult

Changes the current waypoint status to "checked-in".
Returns the result of the action (success or failure, with a reason).

leaveWaypoint(): LeaveWaypointResult

Changes the current waypoint status to "done".
This will end the current waypoint lifecycle and begin the next waypoint available for this task.
When all waypoints are done the SDK will set the task state to done.
When a task is done and no other tasks are available for the user, the sdk will mark the user as offline and subsequently stops sharing his locations and listening for status updates.
Returns the result of the action (success or failure, with a reason).

logout(callback: ResultCallback)

Logs out the user from bringg.
Any subsequent calls to bringg APIs will result in 401
ResultCallback will be called with a LogoutResult enum.
LogoutResult.success() indicates if the user is successfully authenticated.

What’s Next