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 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

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.


GuidanceMgr.getRouteCoordinates

Gets a list of coordinates that describe the current route guidance.
React Native
>=10.19
Type
Method

Syntax

getRouteCoordinates(boolean fromCurrentPosition, double lookAhead, double granularity)

Parameters

fromCurrentPosition - determines whether the coordinate points start from the current position on the route or the entire route.

lookAhead - the distance in miles to look ahead on the route.

granularity - indicates how coarse the list of coordinates will be. A value of 1.0 will return the finest route possible.

Return Value

A list of Coordinate objects that contains the route’s coordinates based on the parameters you set.

Sample Code

const GuidanceMgr = NativeModules.GuidanceMgr;
var coordinates = await GuidanceMgr.getRouteCoordinates(true, 2.0, 1.0 );

GuidanceSettings

A native module containing methods to edit and retrieve CoPilot settings related to Guidance.
React Native
>=10.26
Type
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.
setSpeedAlertAudio(boolean) Void Sets whether or not an audio alert is played when the driver is exceeding the speed limit by a given threshold.
isSpeedAlertAudioEnabled() boolean Returns whether or not an audio alert is played when the driver is exceeding the speed limit by a given threshold.
setSpeedLimitOnMap(boolean) Void Method to turn speed limit display on CoPilot view on and off.
isSpeedLimitOnMap() boolean Returns true if speed limit is displayed on map, false otherwise.
setSpeedAlert(boolean) Void Toggles whether or not alerts will appear when the driver is exceeding the speed limit by a given threshold.
isSpeedAlertEnabled() boolean Returns whether or not an alert should appear when the driver is exceeding the speed limit by a given threshold.
setMapMode(int) Void Sets the current map scheme to the selected day-night background. You can use the constant MapMode as the parameter.
getMapMode() int Gets the current day-night mode of the map. Returns a MapMode value.
setThreshold(int) Void Sets how fast a driver can be over the speed limit before a warning appears in CoPilot. You can use the constant SpeedThreshold as the parameter.
getSpeedLimitThreshold() int Returns the speed the driver must exceed before a speed limit warning appears in CoPilot. Returns a SpeedThreshold value.

GuidanceSettings.setDistanceToSayTurnNow

Sets the distance ahead of the turn at which CoPilot should tell the driver to turn. If CoPilot is set to use metric, the distance will be interpreted as meters. Otherwise, the distance is interpreted in yards.
React Native
>=10.26
Type
Method

Syntax

setDistanceToSayTurnNow(distance)

Parameters

Distance - value of distance to set.

Return Value

None

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
GuidanceSettings.setDistanceToSayTurnNow(1);

GuidanceSettings.getDistanceToSayTurnNow

Gets the distance ahead of the turn at which CoPilot should tell the driver to turn.
React Native
>=10.26
Type
Method

Syntax

getDistanceToSayTurnNow()

Parameters

None

Return Value

Integer value containing the distance at which CoPilot tells the driver to turn

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
var distanceToSayTurnNow = await GuidanceSettings.getDistanceToSayTurnNow();

GuidanceSettings.setSpeedAlertAudio

Sets whether or not an audio alert is played when the driver is exceeding the speed limit by a given threshold.
React Native
>=10.26
Type
Method

Syntax

setSpeedAlertAudio(boolean alert)

Parameters

Alert - boolean whether or not to set the speed alert audio should be played

Return Value

None

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
GuidanceSettings.setSpeedAlertAudio(false);

GuidanceSettings.isSpeedAlertAudioEnabled

Returns whether or not an audio alert is played when the driver is exceeding the speed limit by a given threshold.
React Native
>=10.26
Type
Method

Syntax

isSpeedAlertAudioEnabled()

Parameters

None

Return Value

Boolean value determining whether this setting is enabled or not

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
var speedAlertAudioEnabled= await GuidanceSettings.isSpeedAlertAudioEnabled();

GuidanceSettings.setSpeedLimitOnMap

Method to turn speed limit display on CoPilot view on and off.
React Native
>=10.26
Type
Method

Syntax

setSpeedLimitOnMap(boolean speedLimit)

Parameters

speedLimit - boolean whether or not to turn on speed limit display on CoPilot view.

Return Value

None

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
GuidanceSettings.setSpeedLimitOnMap(false);

GuidanceSettings.isSpeedLimitOnMap

Returns true if speed limit is displayed on map, false otherwise.
React Native
>=10.26
Type
Method

Syntax

isSpeedLimitOnMap()

Parameters

None

Return Value

Boolean value determining whether the speed limit is displayed on map

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
var speedLimitOnMap= await GuidanceSettings.isSpeedLimitOnMap();

GuidanceSettings.setSpeedAlert

Toggles whether or not alerts will appear when the driver is exceeding the speed limit by a given threshold.
React Native
>=10.26
Type
Method

Syntax

setSpeedAlert(boolean speedAlert)

Parameters

speedAlert- boolean whether or not to show alerts when driver is exceeding the speed limit by the given threshold

Return Value

None

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
GuidanceSettings.setSpeedAlert(false);

GuidanceSettings.isSpeedAlertEnabled

Returns whether or not an alert should appear when the driver is exceeding the speed limit by a given threshold.
React Native
>=10.26
Type
Method

Syntax

isSpeedAlertEnabled()

Parameters

None

Return Value

Boolean value determining whether an alert should appear when driver is exceeding the speed limit.

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
var speedLimitOnMap= await GuidanceSettings.isSpeedAlertEnabled();

GuidanceSettings.setMapMode

Sets the current map scheme to the selected day-night background. You can use the constant MapMode as the parameter.
React Native
>=10.26
Type
Method

Syntax

setMapMode(int mapMode)

Parameters

mapMode - int value of the MapMode to set CoPilot day-night background to. Use either MapMode.DAY, MapMode.NIGHT, or MapMode.AUTO.

Return Value

None

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
GuidanceSettings.setMapMode(MapMode.NIGHT);

GuidanceSettings.getMapMode

Gets the current day-night mode of the map. Returns a MapMode value.
React Native
>=10.26
Type
Method

Syntax

getMapMode()

Parameters

None

Return Value

Int value corresponding to the MapMode value

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
var mapMode = await GuidanceSettings.getMapMode();

GuidanceSettings.setThreshold

Sets how fast a driver can be over the speed limit before a warning appears in CoPilot. You can use the constant SpeedThreshold as the parameter.
React Native
>=10.26
Type
Method

Syntax

setThreshold(int threshold)

Parameters

threshold - int value of the SpeedThreshold to set the speed threshold.

Return Value

None

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
GuidanceSettings.setThreshold(SpeedThreshold.LEVEL_2);

GuidanceSettings.getSpeedLimitThreshold

Returns the speed the driver must exceed before a speed limit warning appears in CoPilot. Returns a SpeedThreshold value.
React Native
>=10.26
Type
Method

Syntax

getSpeedLimitThreshold()

Parameters

None

Return Value

Int value corresponding to the SpeedThreshold value

Sample Code

const GuidanceSettings = NativeModules.GuidanceSettings;
var threshold = await GuidanceSettings.getSpeedLimitThreshold();
Last updated May 9, 2024.