Skip to main content

CoPilotMgr (React Native)

Contents

Note: All React Native methods are async functions.

CopilotMgr

Overview
Description A class containing static methods for setting and checking various CoPilot features and settings.
Supported on React Native Since Version 10.14

Methods

Method Name Return Type Description
getUnitsOfMeasure() (Android only)
UnitsofMeasure
Gets the UnitsOfMeasure displayed by CoPilot.
setUnitsOfMeasure(int) (Android only)
void
Sets the UnitsOfMeasure displayed by CoPilot.
getVersionInfo()
CopilotVersion
Returns a CopilotVersion object containing information about CoPilot’s application version number and map data version.
enableGPS() (Android only)
void
Restarts the CoPilot GPS Service and resumes all suspended GPS activities including listening, and processing.
disableGPS() (Android only)
void
Suspends background GPS/routing processing and deregister the CoPilot GPS Service. Background Navigation will not work after this API call.
setTurnInstructionCallbackDelay(int)
Available in CoPilot 10.26.1.300 and Later
void
Sets the time between when turn instruction callbacks onReadyToSpeakTurnInstruction and onSpeakTurnInstructionComplete are fired when CoPilot starts speaking.
getTurnInstructionCallbackDelay()
Available in CoPilot 10.26.1.300 and Later
Int
Retrieves the current delay between when the turn instruction callbacks onReadyToSpeakTurnInstruction and onSpeakTurnInstructionComplete.

Motion Lock

Motion Lock is a safety feature within CoPilot that limits a driver’s access to the CoPilot UI while traveling above a threshold speed.

CopilotMgr.setMotionLockMode

Overview
Description Motion Lock will lock the CoPilot UI once traveling above a specified speed. The UI can be locked down over a different range of modes, restricting more or less of the UI based on integration needs.

The threshold at which Motion Lock will be initiated should be set using setMotionLockSpeedThreshold. This API is just to set the lock mode, it’s not responsible for the actual lock to be activated.

Supported on React Native Since Version 10.14
Type Method

Syntax

void setMotionLockMode(motionLockMode)

Parameters

motionLockMode - The mode that you want CoPilot to lock down once motion lock has been initiated. This will dictate the available options once traveling above the specified threshold speed.

Return

None

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
const MotionLockMode = NativeModules.MotionLockMode;

CopilotMgr.setMotionLockMode(MotionLockMode.ALL_UI_LOCK);

CopilotMgr.getMotionLockMode

Overview
Description Returns the current Motion Lock mode. The mode dictates the extent to which the CoPilot UI will be locked down once initiated and traveling above the threshold speed. This will not return the threshold speed.
Supported on React Native Since Version 10.14
Type Method

Syntax

constant getMotionLockMode()

Parameters

None

Return Values

MotionLockMode

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
var mode = await CopilotMgr.getMotionLockMode();

CopilotMgr.getMotionLockSpeedThreshold

Overview
Description Returns the current speed threshold at which Motion Lock will be enabled. Motion Lock will lock the CoPilot navigation screen, preventing user input, when the vehicle’s speed reaches this threshold.
Supported on React Native Since Version 10.14
Type Method

Syntax

constant getMotionLockSpeedThreshold()

Parameters

None

Return Value

MotionLockSpeedThreshold - The speed above which Motion Lock is active.

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
var speed = await CopilotMgr.getMotionLockSpeedThreshold();

CopilotMgr.setMotionLockSpeedThreshold

Overview
Description Sets the threshold (in mph) for enabling and disabling Motion Lock. Motion Lock prevents user interaction with CoPilot while driving at or above a specified speed threshold.
The values for this API can be found in setMotionLockSpeedThreshold.
Supported on React Native Since Version 10.14
Type Method

Syntax

void setMotionLockSpeedThreshold(motionLockSpeedThreshold)

Parameters

motionLockSpeedThreshold - The speed above which Motion Lock is active.

Return Values

None

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
const MotionLockSpeedThreshold = NativeModules.MotionLockSpeedThreshold;

CopilotMgr.setMotionLockSpeedThreshold(MotionLockSpeedThreshold.LEVEL_2);

CopilotMgr.getUnitsOfMeasure

Overview
Description Returns the measurement type currently set within CoPilot, metric or imperial. Units of Measurement are used for functions including speed, distance and vehicle dimensions.
Supported on React Native Since Version 10.14
Type Method
Measure Metric Imperial
Speed Kilometers per Hour (KPH) Miles per Hour (MPH)
Distance Kilometers, Meters, Centimeters Miles, Feet, Inches
Vehicle Dimensions Meters, Centimeters, Ton Feet, Inches, Ton, 000’s Pounds (US)

Syntax

constant getUnitsOfMeasure()

Parameters

None

Return Value

UnitsOfMeasure - Either METRIC or IMPERIAL units.

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
var unit = await CopilotMgr.getUnitsOfMeasure();

CopilotMgr.setUnitsOfMeasure

Overview
Description Sets whether metric or imperial values should be used within CoPilot. Units of Measurement are used for functions including speed, distance and vehicle dimensions.
Supported on React Native Since Version 10.14
Type Method
Measure Metric Imperial
Speed Kilometers per Hour (KPH) Miles per Hour (MPH)
Distance Kilometers, Meters, Centimeters Miles, Feet, Inches
Vehicle Dimensions Meters, Centimeters, Ton Feet, Inches, Ton, 000’s Pounds (US)

Syntax

void setUnitsOfMeasure(unitsOfMeasure)

Parameters

unitsOfMeasure - Either METRIC or IMPERIAL units.

Return Value

None

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
const UnitsOfMeasure = NativeModules.UnitsOfMeasure;

CopilotMgr.setUnitsOfMeasure(UnitsOfMeasure.METRIC);

CopilotMgr.getVersionInfo

Overview
Description Returns a JSON object (copilotversion), which includes details of the currently installed CoPilot application version number as well as the map data release (year and quarter).
Supported on React Native Since Version 10.14
Type Method

Syntax

JSONObject getVersionInfo()

Parameters

None

Return Value

A CopilotVersion JSON object containing information about the version of the CoPilot application and map data.

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
var cpVersion = await CopilotMgr.getVersionInfo();

CopilotMgr.enableGPS

Overview
Description Restarts the CoPilot GPS Service and resumes all suspended activities following the API call CopilotMgr.disableGPS(). CoPilot will register with the GPS receiver to initiate listening and processing the current position again.
Supported on React Native Since Version 10.14
Type Method

Syntax

void enableGPS()

Parameters

None

Return Value

void

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
CopilotMgr.enableGPS();

CopilotMgr.disableGPS

Overview
Description Attempts to minimize CPU usage by suspending background GPS/routing processing and unregistering the CoPilot GPS Service. Background navigation will not work after this API call; this will mean that your application cannot retrieve updated ETA or distance information.
Supported on React Native Since Version 10.14
Type Method

Syntax

void disableGPS()

Parameters

None

Return Value

void

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
CopilotMgr.disableGPS();

CopilotMgr.setConfigurationSetting

Overview
Description Applies a setting specified by the given ConfigurationSetting object.
Supported on React Native Since Version 10.14
Type Method

Syntax

void setConfigurationSetting(configurationSetting)

Parameters

A JSON Object that has key in ConfigurationName and value in ConfigurationValue

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
const ConfigurationName = NativeModules.ConfigurationName;
const ConfigurationValue = NativeModules.ConfigurationValue;

var configSetting = {};
configSetting.name = ConfigurationName.CHEVRON_DISPLAY;
configSetting.value = ConfigurationValue.CHEVRON_DISPLAY_LAT_LON;
CopilotMgr.setConfigurationSetting(configSetting);

CopilotMgr.getConfigurationSetting

Overview
Description Get the current settings for the given configuration.
Supported on React Native Since Version 10.14
Type Method

Syntax

JSONObject getConfigurationSetting(configurationName)

Parameters

configurationName - The configuration name for which to retrieve the current settings.

Return Value

A JSON object representing the current setting for the given configuration.

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
const ConfigurationName = NativeModules.ConfigurationName;

var config = await CopilotMgr.getConfigurationSetting(
  ConfigurationName.GPS_FREQUENCY
);
console.log(config.value);

Configuration Name and Values

Configuration Name Description Configuration Values
SIDE_OF_STREET_MATCH_TYPE
Available in CoPilot 10.9.0.1180 and Later
Determines whether to use the side of street provided by the address or by the latitude/longitude coordinates in the event that they return conflicting information. REQUIRE_ADDRESS_AND_LAT_LON_MATCH
PREFER_ADDRESS
PREFER_LAT_LON
FLOW_TRAFFIC_AVAILABILITY Whether or not the traffic service is enabled on the device. FLOW_TRAFFIC_ENABLED
FLOW_TRAFFIC_DISABLED
TRAFFIC_BAR_VISIBILITY Whether or not to show the traffic bar. TRAFFIC_BAR_SHOW
TRAFFIC_BAR_HIDE
PLAY_WELCOME Whether or not to play the welcome greeting when starting CoPilot. SAY_WELCOME must also be on. PLAY_WELCOME_TRUE
DO_NOT_PLAY_WELCOME
SAY_WELCOME Whether or not to play the welcome greeting when starting CoPilot. PLAY_WELCOME must also be on. SAY_WELCOME_TRUE
DO_NOT_SAY_WELCOME
SPEAK_CALCULATING_ROUTE Whether to speak calculating route. SPEAK_CALCULATING_ROUTE_TRUE
DO_NOT_SPEAK_CALCULATING_ROUTE
CHEVRON_DISPLAY The information displayed below the chevron. CHEVRON_DISPLAY_NONE
CHEVRON_DISPLAY_CURRENT_ROAD
CHEVRON_DISPLAY_DESTINATION
CHEVRON_DISPLAY_NEAREST_TOWN
CHEVRON_DISPLAY_HEADING
CHEVRON_DISPLAY_LAT_LON
CHEVRON_DISPLAY_NAME_ADDRESS
CHEVRON_DISPLAY_NAME_ADDRESS
CHEVRON_DISPLAY_NAME_ZIPCODE
CHEVRON_DISPLAY_INSIGHTSTOP_NOTE
CHEVRON_DISPLAY_INSIGHTSTOP_CUSTOM
INFO_BAR_LEFT The information to show in the left side info bar. INFO_BAR_DISPLAY_ELEVATION
INFO_BAR_DISPLAY_CURRENT_TIME
INFO_BAR_DISPLAY_ETT
INFO_BAR_DISPLAY_HEADING
INFO_BAR_DISPLAY_SPEED
INFO_BAR_DISPLAY_ETA
INFO_BAR_DISPLAY_DISTANCE
INFO_BAR_RIGHT The information to show in the right side info bar. INFO_BAR_DISPLAY_ELEVATION
INFO_BAR_DISPLAY_CURRENT_TIME
INFO_BAR_DISPLAY_ETT
INFO_BAR_DISPLAY_HEADING
INFO_BAR_DISPLAY_SPEED
INFO_BAR_DISPLAY_ETA
INFO_BAR_DISPLAY_DISTANCE
SHOW_ARRIVAL_POPUP Whether to show a popup when arriving at your destination. SHOW_ARRIVAL_POPUP_TRUE
DO_NOT_SHOW_ARRIVAL_POPUP
ALLOW_ENABLE_COMPLIANCE Whether to turn on route compliance. ENABLE_COMPLIANCE_TRUE
ENABLE_COMPLIANCE_FALSE
POST_TO_FLEET_PORTAL Whether or not CoPilot should communicate with Account Manager (formerly FleetPortal). POST_TO_FLEET_PORTAL_TRUE
POST_TO_FLEET_PORTAL_FALSE
ENABLE_ADVANCED_ALERTS Whether to enable advanced speed alerts. ENABLE_ADVANCE_ALERTS
DISABLE_ADVANCE_ALERTS
ROUTING_SIDE_STREET_MILE_X100 The cost to apply for side of street routing. SIDEOFSTREET_OFF
SIDEOFSTREET_MINIMAL
SIDEOFSTREET_MODERATE
SIDEOFSTREET_AVERAGE
SIDEOFSTREET_STRICT
SIDEOFSTREET_ADHERE
SIDEOFSTREET_STRONGADHERE
EDIT_ACCOUNT_SETTINGS Whether or not to display the Account IDs dialog. EDIT_ACCOUNT_SETTINGS_ENABLE
EDIT_ACCOUNT_SETTINGS_DISABLE
DRIVEXACT_ALERTS Whether or not DriveExact alerts are enabled. DRIVEXACT_ALERTS_ENABLE
DRIVEXACT_ALERTS_DISABLE
DISPLAY_STOP_NAME_STYLE How to display the stop name. STOP_DISPLAY_ALL_INFORMATION
STOP_DISPLAY_NAME_ONLY
STOP_DISPLAY_ADDRESS_ONLY
STOP_SIDE_DISPLAY Whether or not to display the stop side. SHOW_STOP_SIDE
HIDE_STOP_SIDE
RESUME_DOWNLOAD_ON_STARTUP Whether or not to resume partially complete map downloads on startup. RESUME
DO_NOT_RESUME
ENABLE_TURN_ALERT Whether or not to provide alerts ahead of navigation turn instructions. TURN_ALERT_ENABLED
TURN_ALERT_DISABLED
MAP_DOWNLOADS_WIFI_ONLY Whether or not map downloads should be restricted to only take place over Wi-Fi WIFI_ONLY
ALL_CONNECTIONS_ALLOWED
UNIQUE_CLUSTER_STRICTNESS Sets strictness for unique clustering within Optimization. UNIQUE_CLUSTER_OFF
UNIQUE_CLUSTER_ON
UNIQUE_CLUSTER_ONLY
NAV_MESSAGE_DISPLAY
Available in CoPilot 10.9.0.1180 and Later
Sets the type of banner to include at the top of all navigation views. (Default is no banner.) NAV_MESSAGE_DISPLAY_NONE
NAV_MESSAGE_DISPLAY_CURRENT_ROAD
NAV_MESSAGE_DISPLAY_DESTINATION
NAV_MESSAGE_DISPLAY_NEAREST_TOWN
NAV_MESSAGE_DISPLAY_HEADING
NAV_MESSAGE_DISPLAY_LAT_LON
NAV_MESSAGE_DISPLAY_NAME_ADDRESS
NAV_MESSAGE_DISPLAY_NAME_ZIPCODE
NAV_MESSAGE_DISPLAY_INSIGHTSTOP_NOTE
NAV_MESSAGE_DISPLAY_INSIGHTSTOP_CUSTOM
NAV_MESSAGE_DISPLAY_CUSTOM_MESSAGE
ALTERNATE_ROUTES_ALLOWED Set to DO_NOT_ALLOW_ALTERNATE_ROUTES if you do not want CoPilot to suggest any alternate routes to the driver, such as when matching a route planned in the back office. (Default is allow.) ALLOW_ALTERNATE_ROUTES
DO_NOT_ALLOW_ALTERNATE_ROUTES
SHOW_COMPLIANCE_POPUP
Deprecated in CoPilot 10.19.3.48
Whether or not to show the compliance popup. SHOW_COMPLIANCE_POPUP_ENABLED
SHOW_COMPLIANCE_POPUP_DISABLED

CopilotMgr.singleSearchInit

Overview
Description Initializes the single search functionality. This API must be called before you make any other Single Search API calls. The callback onSingleSearchReady will notify you when Single Search has been initialized.
Supported on React Native Since Version 10.26
Type Method

Syntax

void singleSearchInit()

Return Values

None

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
CopilotMgr.singleSearchInit();

CopilotMgr.singleSearch

Overview
Description Starts a single search query. This can only be called after singleSearchInit() has been called and Single Search has been initialized. The single search results can be caught by the callback onSingleSearchFinished().
Supported on React Native Since Version 10.26
Type Method

Syntax

singleSearch(String query)

Parameters

String query- the single search query

Return Values

None

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
CopilotMgr.singleSearch("McDonalds");

CopilotMgr.singleSearchJSON

Overview
Description Starts a single search query using a JSON. This can only be called after singleSearchInit() has been called and Single Search has been initialized. The single search results can be caught by the callback onSingleSearchFinished().
Supported on React Native Since Version 10.26
Type Method

Syntax

singleSearchJSON(String json)

Parameters

String json - the single search JSON parsed as a String

Return Values

None

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
// You will need to read your json file into a string to pass
// in the string as a parameter to the function
var json = readJsonFile(file)
CopilotMgr.singleSearchJSON(json);

Example of a single search JSON

{
	"Query": "1 independence way princeton nj",
	"MaxResults": 20,
	"Location": {
		"Address": {
			"StreetAddress": "1 independence way",
			"City": "Princeton",
			"State": "NJ",
			"Zip": "08540",
			"County": "Mercer",
			"Country": ""
		},
		"Coords": {
			"Lat": "40.361076",
			"Lon": "-74.601515"
		}
	},
	"Searchtype": 1,
	"PoiCategories": ["Airport", "bank", "CAT scales"],
	"Countries": ["CA", "US", "GL"],
	"States": ["NJ", "NM"]
}

CopilotMgr.getSingleSearchPOICategories

Overview
Description Returns the POI search categories available. This API is used to get a list of POI categories that can be recognized by the Single Search web service. This is used to form the json string for the singleSearchJSON API, specifically the PoiCategories field.
Supported on React Native Since Version 10.26
Type Method

Syntax

getSingleSearchPOICategories()

Parameters

None

Return Value

A list of Strings that contain the POI categories

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
var poiCategories = await CopilotMgr.getSingleSearchPOICategories();

CopilotMgr.getSingleSearchCountries

Overview
Description Returns the POI search countries available. This API will return the list of countries the user is able to search within. Users may need it to form the json string (the Countries field) for the singleSearchJSON API.
Supported on React Native Since Version 10.26
Type Method

Syntax

getSingleSearchCountries()

Parameters

None

Return Value

A list of Strings that contain the single search countries available

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
var countries = await CopilotMgr.getSingleSearchCountries();

CopilotMgr.getSingleSearchStates

Overview
Description Returns the POI search states available. This API will return the list of states the user is able to search within. Users may need it to form the json string (the States field) for the singleSearchJSON API.
Supported on React Native Since Version 10.26
Type Method

Syntax

getSingleSearchStates()

Parameters

None

Return Value

A list of Strings that contain the single search states available

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
var countries = await CopilotMgr.getSingleSearchStates();

CopilotMgr.getPOICategories

Overview
Description Returns a list of all of the point of interest (POI) categories in CoPilot.
Supported on React Native Since Version 10.26
Type Method

Syntax

getPOICategories()

Parameters

None

Return Values

A list of Strings that contain the POI categories available.

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
var categories = await CopilotMgr.getPOICategories();

CopilotMgr.searchPOIsAlongRoute

Overview
Description Searches for points of interest (POIs) in one or all categories (such as restaurant, fuel or hotels) along the planned route.
Supported on React Native Since Version 10.26
Type Method

Syntax

searchPOIsAlongRoute(String poiSearchName, List typeIDs, int maxResults)

Parameters

poiSearchName - name of the POI you are searching for

typeIds - list of POI Ids that should be searched. These can get any of the categories retrieved from getPOICategories()

maxResults - maximum number of results expected

Return Values

None

Sample Code

const CopilotMgr = NativeModules.CopilotMgr;
var categories = await CopilotMgr.getPOICategories();
// Here we are searching for McDonalds with all categories selected and we want to see a maximum of 10 results
var pois = await CopilotMgr.searchPOIsAlongRoute("mcdonalds", categories, 10);

StopBuilder

Overview
Description Builds stops using some of the optional parameters for creating stops. The basic workflow is:
1. Create a StopBuilder JSON object using one of the methods below.
2. Call the StopBuilder.geocode API to match the StopBuilder object to a location in the CoPilot map database.
3. Use the Stop JSON objects returned by StopBuilder.Geocode to add stops to your route.
Supported on React Native Since Version 10.14
Type Native Module

Methods

Method Name Return Type Description
fromLatLon(Coordinate) StopBuilder Method to create a StopBuilder from a latitude / longitude combination.
fromCountryAndPostalCode(String, String) StopBuilder Method to create a StopBuilder from a country and postal code combination.
fromCityAndState (String, String) StopBuilder Method to create a StopBuilder from a city and state combination.
geocode(GeocodeSearchType) JSON array of Stop objects Geocodes the address and returns the list of stops.
getNearbyStreets
String
Returns list of nearby streets relative to the coordinates passed to CoPilot, returned as StreetSearchResult

Sample Code

const StopBuilder = NativeModules.StopBuilder;
const GeocodeSearchType = NativeModules.GeocodeSearchType;

var latlon = {};
latlon.latitude = 40.36842;
latlon.longitude = -74.655036;
var stopBuilder = await StopBuilder.fromLatLon(latlon);
var stops = await StopBuilder.geocode(
  stopBuilder,
  GeocodeSearchType.BEST_MATCH
);

StopBuilder.Geocode(GeocodeSearchType)

Overview
Description Geocodes the address and returns the list of stops.
Supported on React Native Since Version 10.14
Type Method

Syntax

JSONArray geocode(stopBuilder, geocodeSearchType)

Parameters

A StopBuilder JSON object, which contains information about the stop.

geocodeSearchType - The type of geocode matching

Sample Code

const StopBuilder = NativeModules.StopBuilder;
const GeocodeSearchType = NativeModules.GeocodeSearchType;

var latlon = {};
latlon.latitude = 40.36842;
latlon.longitude = -74.655036;
var stopBuilder = await StopBuilder.fromLatLon(latlon);
var stops = await StopBuilder.geocode(
  stopBuilder,
  GeocodeSearchType.BEST_MATCH
);

StopBuilder.getNearbyStreets

Overview
Description Returns a list of nearby streets relative to the coordinates passed to CoPilot. All nearby street names within the configurable distance, set as a maximum of 1 mile, will be returned. The number of streets returned can be set up to a maximum of 10. Streets will be returned sorted in order of distance.
Supported on React Native Since Version 10.14
Type Method

Syntax

JSONArray getNearbyStreets(stopBuilder, distance, maxResults)

Parameters

A StopBuilder JSON object, which contains information about the stop.

distance- An int value for the maximum distance to return street names from. Maximum of 1 mile.

maxResults - An int value for the number of results to be returned. Maximum of 10.

Return Value

JSON Array of StreetSearchResult JSON objects

Sample Code

const StopBuilder = NativeModules.StopBuilder

var latlon = {};
latlon.latitude = 40.355233;
latlon.longitude = -74.604895;
var stopBuilder = await StopBuilder.fromLatLon(latlon);

var nearbyStreets = await StopBuilder.getNearbyStreets(stopBuilder, 5, 10)
Last updated July 2, 2024.