Tasks
Overview
The tasks functionality and the events you can customize includes the following:
- get a driver's tasks list and customize get tasks list events
- refresh a driver's tasks list, managing tasks lists and customize refresh tasks list events
- start a task and customize start tasks events
- update a task when a driver arrives at a way point and customize way point arrival events
- update a task when a driver leaves a way point and customize leave way point events
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:
|
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:
|
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:
|
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:
|
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()
Updated about 6 years ago