Manage the Zendrive Trip Lifecycle
Zendrive's Trip Lifecycle comprises of the following:
Automatic Trip Lifecycle
Zendrive SDK automatically detects trips and provides a number of events to registered event listeners. Each listener will be provided with event data which can be used to implement your business logic.
The Automatic Trip Lifecycle comprises the following:
The user starts driving. The user may be driving themselves or be a passenger.
Zendrive SDK detects that a trip has started and the registered event listener is called with the
on-drive-start
event type.If the OS kills the application or if the device restarts, Zendrive SDK resumes the trip and the registered event listener is called with the
on-drive-resume
event.If there's a collision, the registered event listener is called with the
on-accident
event. You must apply your own business logic using the returned data.The user stops driving and Zendrive SDK detects trip end. The registered event listener is called with an event of kind
on-drive-end
.After the trip end event is notified, Zendrive SDK takes time to process the trip. After processing, the registered event listener is called with an event of kind
on-drive-analyzed
.
In each of these cases you may implement your own business logic with data.
Manual Trip Lifecycle
In a manual trip, your application uses the startDrive
and stopManualDrive
methods to initiate and end trip detection. See Manual Trip Tagging for more information.
Zendrive SDK provides a number of events to the registered event listeners during a trip lifecycle. Each listener will be provided with event data which can be used to implement your business logic.
The Manual Trip Lifecycle comprises the following:
Your application calls the
startDrive
method to start a trip. The registered event listener is called with an event of kindon-drive-start
.If the OS kills the application or the device restarts, the SDK resumes the trip and the registered event listener is called with an event of kind
on-drive-resume
.If there is a collision, the registered event listener is called with an event of
kind on-accident
. In this case, you need to apply your own business logic using the returned data.Your application calls the
stopManualDrive
method to end the trip. The registered event listener is called with an event of kindon-drive-end
.After the trip end event is notified, Zendrive SDK takes time to process the trip. After processing, the registered event listener is called with an event of kind
on-drive-analyzed
.
In each of these cases you may implement your own business with given data.
Last updated
Was this helpful?