GuidanceMgr (React Native)
Contents
Note: All React Native methods are async functions.
Native Module
Methods
Method Name | Return Type | Description |
---|---|---|
getCurrentRoad() |
road | Gets information about the current road. |
getTurnInstruction (boolean) |
TurnInstruction | Gets the upcoming turn instruction. |
getLaneAssist() |
LaneAssistInfo | Gets the current lane assist information. |
getCurrentPosition() |
PositionInfo | Obtains a variety of data pertaining to CoPilot’s current or last known position including. |
getETA() |
string | Obtains the current Estimated Time of Arrival for the first destination of the trip. |
getDistanceToDestination() |
double | Gets the distance from CoPilot’s current position (map-snapped) to its destination. |
enableEarlyTurnWarning()Available in CoPilot 10.26.1.300 and Later |
Void | Enables/Disables the turn warning at 2 KM or 2 Miles. |
isEarlyTurnWarningEnabled()Available in CoPilot 10.26.1.300 and Later |
Boolean | Returns whether the 2 KM or 2 Mile turn warning is enabled. |
enableNearTurnWarning()Available in CoPilot 10.26.1.300 and Later |
Void | Enables/Disables the turn warning at .5 KM or .5 Mile. |
isNearTurnWarningEnabled()Available in CoPilot 10.26.1.300 and Later |
Boolean | Returns whether the .5 KM or .5 Mile turn warning is enabled. |
enableFarTurnWarning()Available in CoPilot 10.26.1.300 and Later |
Void | Enables/Disables the turn warning at 1 KM or 1 Mile. |
isFarTurnWarningEnabled()Available in CoPilot 10.26.1.300 and Later |
Boolean | Returns whether the 1 KM or 1 Mile turn warning is enabled. |
enableTurnRestrictions(boolean)Available in CoPilot 10.26.1.300 and Later |
Void | Sets whether turn restrictions will be displayed during navigation. |
isTurnRestrictionEnabled()Available in CoPilot 10.26.1.300 and Later |
Boolean | Returns whether turn restrictions will display during navigation. |
enableClearTurnView(boolean)Available in CoPilot 10.26.1.300 and Later |
Void | Sets whether clear turn view is enabled. |
isClearTurnViewEnabled()Available in CoPilot 10.26.1.300 and Later |
Boolean | Returns whether clear turn view is enabled. |
enableClearTurnViewOnlyForHighways(boolean)Available in CoPilot 10.26.1.300 and Later |
Void | Sets whether clear turn view is enabled only on highways. |
isClearTurnViewEnabledOnlyForHighways()Available in CoPilot 10.26.1.300 and Later |
Boolean | Returns whether clear turn view is enabled only on highways. |
setClearTurnInstructionDrawDistance(int)Available in CoPilot 10.26.1.300 and Later |
Void | Sets when clear turn instructions will be drawn in 1/10 KM/Miles. |
setClearTurnInstructionHideDistance(int)Available in CoPilot 10.26.1.300 and Later |
Void | Sets when clear turn instructions will be hidden in 1/10 KM/Miles. |
getClearTurnInstructionDrawDistance()Available in CoPilot 10.26.1.300 and Later |
Int | Returns the distance at which clear turns are displayed in 1/10 KM/Miles. |
getClearTurnInstructionHideDistance()Available in CoPilot 10.26.1.300 and Later |
Int | Returns the distance at which clear turns are hidden in 1/10 KM/Miles. |
Hooks and Callbacks
Hooks and Callbacks related to Guidance can be found below.
GuidanceListener |
---|
onArrivedAtStop |
onOverSpeedLimitEvent |
onCrossedCountryBorder |
onETAChanged |
onEstimatedTravelTimeUpdated |
onDistanceToDestinationUpdated |
onPositionUpdate |
onTurnInstructionEvent |
onTrafficInfoProcessedForCurrentRoute |
GuidanceMgr.getCurrentRoad
Method
Syntax
JSONObject getCurrentRoad()
Parameters
None
Return Value
A Road JSON object containing information about the current road.
Sample Code
const GuidanceMgr = NativeModules.GuidanceMgr;
var currentRoad = await GuidanceMgr.getCurrentRoad();
GuidanceMgr.getTurnInstruction
Method
Syntax
JSONObject getTurnInstruction()
Parameters
None
Return Value
A TurnInstruction JSON object that contains the information about the upcoming turn.
Sample Code
const GuidanceMgr = NativeModules.GuidanceMgr;
var currentTurnInstruction = await GuidanceMgr.getTurnInstruction();
GuidanceMgr.getLaneAssist
Method
Syntax
JSONObject getLaneAssist()
Parameters
None
Return Value
A LaneAssistInfo JSON object with the current lane assist information.
Sample Code
const GuidanceMgr = NativeModules.GuidanceMgr;
var laneAssist = await GuidanceMgr.getLaneAssist();
GuidanceMgr.getCurrentPosition
Provides information relating to CoPilot’s current or last known location. This will include coordinates as well as other location information detailing the quality of the GPS fix and the number of satellites contributing to the current GPS fix.
Note: The last known position will be returned when the current location cannot be determined. This could potentially be from a previous run of the application, depending when this API is used.
Method
Syntax
JSONObject getCurrentPosition()
Return Value
A PositionInfo JSON object populated with data pertaining to CoPilot’s current or last known position.
Sample Code
const GuidanceMgr = NativeModules.GuidanceMgr;
var position = await GuidanceMgr.getCurrentPosition();
GuidanceMgr.getETA
Method
Syntax
String getETA()
Parameters
None
Return Value
A string indicating the estimated time of arrival.
Sample Code
const GuidanceMgr = NativeModules.GuidanceMgr;
var eta = await GuidanceMgr.getETA();
GuidanceMgr.getDistanceToDestination
Method
Syntax
double getDistanceToDestination()
Parameters
None
Return Value
The distance remaining to the destination. This distance will be in miles if CoPilot is set to use imperial measurements or meters if CoPilot is set to use metric measurements.
Sample Code
const GuidanceMgr = NativeModules.GuidanceMgr;
var distance = await GuidanceMgr.getDistanceToDestination();
Note: All React Native methods are async functions.
GuidanceSettings
Native Module
Methods
Method Name | Return Type | Description |
---|---|---|
setDistanceToSayTurnNow(int) |
Void | Sets the distance ahead of the turn where CoPilot should speak its “Turn Now” announcement. |
getDistanceToSayTurnNow() |
int | Gets the currently set distance ahead of a turn at which CoPilot will speak its “Turn Now” announcement. |