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 valueOrder state description
* (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_TASKnew active order received from Bringg platform servers.
ON_THE_WAY_TO_FIRST_DESTINATIONactive order was successfully started, user is currently on the way to the first order destination.
ARRIVED_AT_CURRENT_DESTINATIONuser has arrived and is now at the current order destination.
ON_THE_WAY_TO_NEXT_DESTINATIONuser 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.
DONEactive order is completed successfully. If more orders are available next order will become active, if not NO_TASK state event will follow this event.
CANCELEDactive order is no longer available for the user on Bringg platform