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. |
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();