Optional: Registering task state live data
Receive updates on task status changes to your app that did not originate from the SDK. For example, a dispatcher cancelling the task on Bringg Web.
Call sdkInstance.activeTask().observe() to receive events when the active task is updated.
The observer will receive updates when task states change or when the underlying task data is changed (eta, notes, destination updates, schedules, etc.).
Observer will receive updates using TaskState model providing:
currentState - enum indicating the active order state if any. (non-null)
task - current active order data if any. (null when state is NO_TASK, non-null otherwise)
TaskStates enum
TaskStates describe the current active order state:
Enum value | Order state description |
---|---|
NO_TASK * (TaskState.task value will be null) | no active order call startTask using your provided Bringg task_id to start a new active order flow. |
NEW_TASK | new active order received from Bringg platform servers. |
ON_THE_WAY_TO_FIRST_DESTINATION | active order was successfully started, user is currently on the way to the first order destination. |
ARRIVED_AT_CURRENT_DESTINATION | user has arrived and is now at the current order destination. |
ON_THE_WAY_TO_NEXT_DESTINATION | user has left the current destination and is now on the way to the next destination of this order. next event will be ARRIVED_AT_CURRENT_DESTINATION again until all task waypoints are done. * only happens on multiple destination orders. |
DONE | active order is completed successfully. If more orders are available next order will become active, if not NO_TASK state event will follow this event. |
CANCELED | active order is no longer available for the user on Bringg platform |
Updated over 2 years ago