Skip to main content

Event listeners

Register a NaviHelperEventListener to receive API request results and navigation-state changes.

Event categories

CategoryCallback
Route searchonRouteStarted(), onRoutingCompleted(), onRouteCancelled(), onReRouteEnded(), onRouteOptionChanged()
Destinations and waypointsonDestinationChanged(), onDestinationArrived(), onWaypointChanged(), onWayPointArrived()
Information requestsonBookmarkInfo(), onBookMarkChanged(), onRecentDestinationInfo(), onCurrentLocationInfo(), onDestinationInfo(), onWayPointInfo(), onRouteStateInfo(), onTBTInfo(), onChargerOperatorInfo(), onTripInfo(), onNavigationStatus(), onDrivingInfo(), onCurrentRoadSpeedLimit(), onCameraAlert(), onCautionPointInfo()
ErrorsonError()

The events that are delivered may vary depending on the Navigation app's implementation scenarios.

Add a listener

Override only the callbacks your app needs, and register the listener after initializing the SDK.

import ai.pleos.playground.navi.constants.NaviErrorCode
import ai.pleos.playground.navi.data.RouteStartInfo
import ai.pleos.playground.navi.helper.listener.NaviHelperEventListener

private val naviEventListener = object : NaviHelperEventListener {
override fun onRouteStarted(routeStartInfo: RouteStartInfo) {
// Handle the start of a route search.
}

override fun onRoutingCompleted() {
// Handle route search completion.
}

override fun onError(errorCode: NaviErrorCode) {
// Handle the navigation error.
}
}

naviHelper.addListener(naviEventListener)

Remove a listener

When the listener is no longer needed, or before releasing the SDK, remove the same listener instance that was registered.

naviHelper.removeListener(naviEventListener)

For error-specific handling, see Error handling.