Skip to main content

GuidanceMgr (React Native)

Contents

Note: All React Native methods are async functions.

A native module containing methods for obtaining navigational information such as location and road info.
React Native
>=10.14
Type
Native Module

Methods

Method NameReturn TypeDescription
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

Gets information about the current road.
React Native
>=10.14
Type
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

Gets information about the upcoming turn instruction.
React Native
>=10.14
Type
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

Returns a JSON object representing the current lane assist information.
React Native
>=10.14
Type
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.

React Native
>=10.14
Type
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

Provides details of the current estimated time of arrival (ETA) for the first destination of the trip that CoPilot is navigating. If CoPilot has not yet started or does not have a destination entered, an exception will be thrown.
React Native
>=10.14
Type
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

Provides the distance from the current location to the destination that has been entered into CoPilot. This will be returned in miles or kilometers depending on the settings. If CoPilot has not been started, an error will be returned.
React Native
>=10.14
Type
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

A native module containing methods to edit and retrieve CoPilot settings related to Guidance.
React Native
>=10.26
Type
Native Module

Methods

Method NameReturn TypeDescription
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.
Last updated September 15, 2023.