A callback is a method that is called at a particular time in the code, often
for logging purposes. An outside application can create listeners that detect
when these methods are called, and act accordingly by defining the methods. A
hook is the same as a callback, but also demands that a value be returned from
the outside application when detected by the listener. This allows communication
between CoPilot and the software that is integrating it.
Called when CoPilot has finished shutting down. We recommend that you shut down the service only when necessary. It is also best to wait at least 2 or 3 seconds to restart CoPilot after you shut it down. Restarting too frequently or too quickly can cause the application to crash.
Called when one or more stops have been added to the current trip. If a trip exists and then a new trip is planned, onStopsDeleted() is called, followed by onStopsAdded()
onStopsDeleted will be called if stops are successfully deleted. The callback also returns a list of stops that were deleted. For RouteMgr.deleteStop, the returned stop list should only have one element. But for RouteMgr.removeAllStops, the return stop list can have more than one elements.
Callback is provided when a user has registered a GuidanceListener with the onArrivedAtStop class. Uses the native module ArrivalStatus, to provide status details of the stop.
The approaching and arrival status messages are controlled by a set of configuration values that can be set within the product/user configuration file.
[User Settings] “ApproachingStopDistHundredths”, and “ArrivedStopDistHundredths” options both indicate the distance threshold, in hundredths of a mile, from your stop, where the user will see the prompt (popup, sound, or speech) to be shown.
The defaults are:
If you would like the Arrived prompt, it is recommended to prompt at 1 or 2 hundredths of a mile (50 or 100 feet from the stop). “ArrivedStopDistHundredths“=1 or 2
[GPS] “SpeakApproachingDestinationInstr”, “SpeakArrivedAtDestinationInstr”, “PlayArrivedAtDestinationSound”, “PlayApproachingDestinationSound” can be used to modify how CoPilot indicates “Approaching or Arrived” status (whether prompted with Text To Speech, sound, or no prompt). The onArrivedAtStop callback will fire regardless of these settings. If they are all accidentally set to on, the Speech announcement will prompt.
[User Settings] “ShowArrivalPopup” can be used to request CoPilot DOES NOT show the Arrival Popup. Showing or not showing the popup, does NOT have any affect on whether or not the status event is fired through CPIK libraries.
Called when new guidance information is available.
onTrafficInfoProcessedForCurrentRoute
Method JavaScript:
onTrafficInfoProcessedForCurrentRoute = () => {}
Type:
Callback
Description:
Called when traffic information is received and processed from the traffic server for the current route. The customer application gets the ETA as well traffic delay information by using RouteMgr.getRouteLegs().get(0).getETA() and RouteMgr.getRouteLegs().get(0).getTrafficDelay() respectively.
Called when CoPilot has started a MapSure sync in response to a call to the API getMapSureOverride().
onMapSureOverrideSyncFailed
Method JavaScript:
onMapSureOverrideSyncFailed = () => {}
Type:
Callback
Description:
Called when CoPilot has triggered a MapSure sync in response to a call to the API getMapSureOverride() but it has failed.
onMapSureOverrideSyncSuccess
Method JavaScript:
onMapSureOverrideSyncSuccess = (cbData) => {}
Callback Data:
“successful”: int “failed”: int
Data Type:
JSON Object
Description:
Provides notification that a MapSure Override sync has completed and it includes the number of edits that have been successfully updated and the number that have failed
LicenseListener
LicenseListeners are hooks and callbacks from LicenseMgr
onLicenseMgtLogin Available in CoPilot 10.14.0.487 and Higher
Called to provide Optimization result once Optimization finished. It will provide final ETA, total distance as well individual stop’s optimization number, ETA and distance.