Skip to main content

Make the first API call

Describes the order of NaviHelper API calls and example scenarios that can be implemented with the API.

API call order

1. Initialize SDK

When starting the NaviHelper SDK, call the initialize API to initialize the NaviHelper SDK.

val naviHelper: NaviHelper = NaviHelper(context)
naviHelper.initialize()

2. Add eventListener

Before registering the NaviHelper app, call the addEventListener API to register the NaviHelper event callbacks.

naviHelper.addListener(listener: ai.pleos.playground.navi.helper.listener.NaviHelperEventListener)

3. Remove eventListener

Before exiting the Navigation app, release the registered event callbacks. To release event callbacks, call the removeEventListener API.

naviHelper.removeListener(listener: ai.pleos.playground.navi.helper.listener.NaviHelperEventListener)

4. Release SDK

Call the release API to free the resources of the NaviHelper SDK.

naviHelper.release()

Example API usage scenarios

1. Set, confirm and cancel destination

// Set destination
naviHelper.requestRoute(
RouteInfo(
latitude = 37.48544722,
longitude = 127.03636666,
poiId = "36khp37hh8gqcm5nqhe5",
poiName = "42dot",
poiSubId = "0",
address = "Seoul, Gangnam-gu, NamBusunhwan-ro 2621"
)
)

// Confirm destination
naviHelper.getDestinationInfo()

// Receive data with onDestinationInfo callback
override fun onDestinationInfo(destinationInfo: DestinationInfo) {
Log.d(logTag, "onDestinationInfo $destinationInfo")
}

// Cancel destination
naviHelper.cancelRoute()


2. Set and delete waypoints

// Set destination
naviHelper.requestRoute(
RouteInfo(
latitude = 37.48544722,
longitude = 127.03636666,
poiId = "36khp37hh8gqcm5nqhe5",
poiName = "42dot",
poiSubId = "0",
address = "Seoul, Gangnam-gu, NamBusunhwan-ro 2621",
)
)

// Add waypoint
naviHelper.addWaypoint(
RequestWaypointInfo(
latitude = 37.41275833,
longitude = 127.09481944,
waypointIndex = WaypointIndex.FIRST,
poiId = "36khp2hdj2cfcm5nqhe3",
poiName = "Software Dream Center",
poiSubId = "0",
address = "6, Changup-ro 40beon-gil, Sujeong-gu, Seongnam-si, Gyeonggi-do",
)
)

// Receive data with onWaypointInfo callback
override fun onWaypointInfo(waypointInfo: List<WaypointInfo>) {
Log.d(logTag, "onWaypointInfo $waypointInfo")
}

// Delete waypoint
naviHelper.removeWaypoint(WaypointIndex.FIRST)

// Cancel destination
naviHelper.cancelRoute()

3. Change route options

// Set destination
naviHelper.requestRoute(
RouteInfo(
latitude = 37.48544722,
longitude = 127.03636666,
poiId = "36khp37hh8gqcm5nqhe5",
poiName = "42dot",
poiSubId = "0",
address = "Seoul, Gangnam-gu, NamBusunhwan-ro 2621",
)
)

// Change route option: switch to highway-priority
naviHelper.changeRouteOption(RouteOption.HIGHWAY)

// Receive changed data with onRouteOptionChanged callback
override fun onRouteOptionChanged(routeOption: RouteOption) {
Log.d(logTag, "onRouteOptionChanged $routeOption")
}

// Cancel destination
naviHelper.cancelRoute()

4. Re-route

// Set destination
naviHelper.requestRoute(
RouteInfo(
latitude = 37.48544722,
longitude = 127.03636666,
poiId = "36khp37hh8gqcm5nqhe5",
poiName = "42dot",
poiSubId = "0",
address = "Seoul, Gangnam-gu, NamBusunhwan-ro 2621"
)
)

// Request re-route
naviHelper.requestReRoute()

// Cancel destination
naviHelper.cancelRoute()

5. Confirm navigation information

// Set destination
naviHelper.requestRoute(
RouteInfo(
latitude = 37.48544722,
longitude = 127.03636666,
poiId = "36khp37hh8gqcm5nqhe5",
poiName = "42dot",
poiSubId = "0",
address = "Seoul, Gangnam-gu, NamBusunhwan-ro 2621"
)
)

// Check bookmark information
naviHelper.getBookmarkInfo()

// Receive data with onBookmarkInfo callback
override fun onBookmarkInfo(bookmarkInfo: List<BookmarkInfo>) {
Log.d(logTag, "onBookmarkInfo $bookmarkInfo")
}

// Check current location information
naviHelper.getCurrentLocationInfo()

// Receive data with onCurrentLocationInfo callback
override fun onCurrentLocationInfo(currentLocationInfo: CurrentLocationInfo) {
Log.d(logTag, "onCurrentLocationInfo $currentLocationInfo")
}

// Check recent destination information
naviHelper.getRouteStateInfo()

// Receive data with onRouteStateInfo callback
override fun onRouteStateInfo(routeStateInfo: RouteStateInfo) {
Log.d(logTag, "onRouteStateInfo $routeStateInfo")
}

// Check recent destination information
naviHelper.getRecentDestinationInfo()

// Receive data with onRecentDestinationInfo callback
override fun onRecentDestinationInfo(recentDestinationInfo: RecentDestinationInfo) {
Log.d(logTag, "onRecentDestinationInfo $recentDestinationInfo")
}

// Cancel destination
naviHelper.cancelRoute()

6. Check charger operator information

naviHelper.getChargerOperatorInfo()

// Receive data with onChargerOperatorInfo callback
override fun onChargerOperatorInfo(chargerOperatorList: List<ChargerOperator>) {
Log.d(logTag, "onChargerOperatorInfo chargerOperatorList")
}