Overview

The tasks functionality and the events you can customize includes the following:

Getting Tasks

there are 2 options to obtain tasks:

getTasks

Use to get the most the driver's tasks list from the server to the device. this method can use cached results.

void getTasks(GetTasksResultCallback callback)

Parameters

callback

GetTasksResultCallback

Use to implement a new GetTasksResultCallback instance, including the callback interface methods that will be invoked by the Bringg Driver SDK for Android for get task results events.

GetTasksResultCallback

onTasksResult

Invoked when a get tasks list event succeeds. The tasks list and last time the list was updated are returned.

void onTasksResult(List<Task> tasks, long lastTimeUpdated)

Parameters

lastTimeUpdated

long

The last time the task list was updated.

tasks

List

A list of references to the Task data type objects containing detailed information about a the driver's tasks.

refreshTasks

Use to force refresh the driver's tasks list from the server to the device. this method does not use cached results but will return errors when too many calls are used.
it is recommended to use this method for when implementing a "pull to refresh" feature in your app but otherwise use the above getTasks method.

void refreshTasks(RefreshTasksResultCallback callback)

Parameters

RefreshTasksResultCallback

callback

RefreshTasksResultCallback

Use to implement a new RefreshTasksResultCallback instance, including the callback interface methods that will be invoked by the Bringg Driver SDK for Android for refresh tasks events.

onRefreshTasksFailure

Invoked when a task refresh event fails. An error code is returned.

void onRefreshTasksFailure(int error)

Parameters

error

int

The error that occurred when attempting to refresh the tasks. The values are:

  • 1 - the attempt to refresh the tasks returned no result
  • 2 - too many attempts to refresh the tasks occurred
  • 3 - the attempt to refresh the tasks is pending

onRefreshTasksSuccess

Invoked when a task refresh event succeeds.

void onRefreshTasksSuccess(OpenTasksResult openTasksResult)

openTasksResult

OpenTasksResult

An instance of the OpenTasksResult class. You can use the Bringg Driver SDK for Android available methods in this class to tasks lists functionality in your own app.

OpenTasksResult

getTasks

public List<Task> getTasks()

Method Type

Task

List

A List of references to Task data type objects.

getPendingTasksData

Use to get information about pending tasks.

public PendingTasksData getPendingTasksData()

Method Type

PendingTasksData

A Bringg Driver SDK for Android data type containing the following:

  • task count of tasks being prepared
  • task count of task that are ready
  • the number of drivers in the store

isSuccess

Use to determine whether tasks were found by a task action.

public boolean isSuccess()

Method Type

boolean

Indicates whether tasks were found by a task action using the OpenTasksResult class as a parameter.

Actions On Tasks

startTask

Use to start a task for the driver. This method will trigger a callback.

void startTask(long taskId, TaskActionCallback callback)

Parameters

callback

TaskActionCallback

Implement a new TaskActionCallback instance, including the callback interface methods that will be invoked by the Bringg Driver SDK for Android for task action events.

taskId

long

The Id of the task for which the driver is arriving at the way point.

TaskActionCallback

onActionDone

Invoked when a task action event succeeds.

 void onActionDone()

onActionFailed

Invoked when an task action attempt fails. An error code is returned.

void onActionFailed(int errorCode)

Parameters

errorCode

int

The error number indicating the reason the leave way point action failed. The values are:

  • 1 - the task was not found
  • 2 - the task already started
  • 3 - the task was not started
  • 4 - the task is scheduled in the future
  • 5 - the driver already arrived at the way point
  • 6 - the way point was not found
  • 7 - the driver has not arrived at the way point
  • 8 - the way point is already done
  • 9 - the way point is not the current way point
  • 10 - the way point is home

arriveToWayPoint

Use to update a task that the driver arrived at a way point. This method will trigger a callback.

void arriveToWayPoint(long taskId, long wayPointId, TaskActionCallback callback)

Parameters

callback

TaskActionCallback

Use to implement a new TaskActionCallback instance, including the callback interface methods that will be invoked by the Bringg Driver SDK for Android for task action events.

taskId

long

The Id of the task for which the driver is arriving at the way point.

wayPointId

long

The Id of the way point at which the driver is arriving.

leaveWayPoint

Use to update a task that the driver left a way point. This method will trigger a callback.

void leaveWayPoint(long taskId, long wayPointId, LeaveWayPointActionCallback callback)

Parameters

callback

TaskActionCallback

Use to implement a new TaskActionCallback instance, including the callback interface methods that will be invoked by the Bringg Driver SDK for Android for task action events.

taskId

long

The Id of the task for which the driver is arriving at the way point.

wayPointId

long

The Id of the way point at which the driver is arriving.

LeaveWayPointActionCallback

onActionFailed

Invoked when a leave way point event fails. An error code is returned.

void onActionFailed(int errorCode)

Parameters

errorCode

int

The error number indicating the reason the leave way point action failed. The values are:

  • 1 - the task was not found
  • 2 - the task already started
  • 3 - the task was not started
  • 4 - the task is scheduled in the future
  • 5 - the driver already arrived at the way point
  • 6 - the way point was not found
  • 7 - the driver has not arrived at the way point
  • 8 - the way point is already done
  • 9 - the way point is not the current way point
  • 10 - the way point is home

onNextWayPointStarted

Invoked when a leave way point event succeeds. The Id of the next way point is returned.

void onNextWayPointStarted(long wayPointId)

Parameters

wayPointId

long

The Id of the next way point in the task.

onTaskDone

Invoked when a task completion event occurs. This callback requires no parameters and does not return a value.

void onTaskDone()