Skip to content

GPSDevice

Overview
Description This class should be used when GPS position is being received via an external device. If using an external device this class can be used to update the GPS position using locations or NMEA sentences. If internal device GPS receiver is being used this class is not required.
Note this class cannot be used to supplement the GPS position.
Supported on Android Since Version 9.6.0.821
Type Class
Package com.alk.cpik.guidance

Methods

Method Name Return Type Description
open() void CoPilot is capable of receiving GPS Locations externally. This is useful when using a non-integrated GPS device.
open(Boolean) void Opens a GPS device and causes CoPilot to stop listening for GPS updates. After it is opened, a device can be sent location updates via the update() calls.
close() void Restores CoPilot to its default state of listening to an internal GPS device. To be called when external GPS locations are done being sent.
sendGPSLocation(Location) void Sends a GPS location into CoPilot.Open() must be called prior to sending any locations.
sendGPSLocation(Coordinate) void Sends a GPS location into CoPilot.Open() must be called prior to sending any locations.
sendNMEASentence(String) void Sends an NMEA sentence into CoPilot.Open() must be called prior to sending any sentences using this API.
sendNMEASentenceWithOverride(String,double) void Sends an NMEA sentence in to CoPilot.Open() must be called prior to sending any sentences using this API.

GPSDevice.open

Overview
Description Opens a GPS device and causes CoPilot to stop listening for GPS updates. After it is opened, a device can be sent location updates via the update() calls. This is unnecessary if we have configured a build to exclusively accept external GPS input. This call will disable tunnel mode.
Supported on Android Since Version 9.6.0.821
Type Method
Package com.alk.cpik.guidance

Syntax

void open()

Sample Code

// Get the GPS device
GPSDevice gpsDevice = GuidanceMgr.getGPSDevice();

// Open the GPS device
// Note: This will disable tunnel mode!
gpsDevice.open();

Related APIs

  • GPSDevice.close()
  • GPSDevice.sendGPSLocation()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.open (boolean)

Overview
Description Opens a GPS device and causes CoPilot to stop listening for GPS updates. After it is opened, a device can be sent location updates via the update() calls. This is unnecessary if we have configured a build to exclusively accept external GPS input.
Supported on Android Since Version 9.6.0.821
Type Method
Package com.alk.cpik.guidance

Syntax

void open(Boolean)

Parameters

boolean disableTunnelMode - Whether or not to disable tunnel mode.

Sample Code

// Get the GPS device
GPSDevice gpsDevice = GuidanceMgr.getGPSDevice();
boolean disableTunnelMode = false;

// Open the GPS device, but don't disable tunnel mode
gpsDevice.open(disableTunnelMode);

Related APIs

  • GPSDevice.close()
  • GPSDevice.sendGPSLocation()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.close

Overview
Description Restores CoPilot to its default state of listening to an internal GPS device. To be called when external GPS locations are done being sent.
Supported on Android Since Version 9.6.0.821
Type Method
Package com.alk.cpik.guidance

Syntax

void close()

Sample Code

// Get the GPS device
GPSDevice gpsDevice = GuidanceMgr.getGPSDevice();
boolean disableTunnelMode = false;

// Open the GPS device, but don't disable tunnel mode
gpsDevice.open(disableTunnelMode);

// Close the GPS device
gpsDevice.close();

Related APIs

  • GPSDevice.open()
  • GPSDevice.sendGPSLocation()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.sendGPSLocation (Send a Location)

Overview
Description Sends a GPS location into CoPilot. Open() must be called prior to sending any locations.
Supported on Android Since Version 9.6.0.821
Type Method
Package com.alk.cpik.guidance

Syntax

void sendGPSLocation(Location)

Parameters

Location - An object with the information about the current position.

Sample Code

// Get the GPS device
GPSDevice gpsDevice = GuidanceMgr.getGPSDevice();
boolean disableTunnelMode = false;
// Open the GPS device, but don't disable tunnel mode
gpsDevice.open(disableTunnelMode);

// get the location
Location location = new Location(LocationManager.*NETWORK_PROVIDER*);
// Send a GPS location as an update
gpsDevice.sendGPSLocation(location);

Related APIs

  • GPSDevice.open()
  • GPSDevice.close()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.sendGPSLocation (Send a Coordinate)

Overview
Description Sends a GPS coordinate into CoPilot. Open() must be called prior to sending any coordinate.
Supported on Android Since Version 9.6.0.821
Type Method
Package com.alk.cpik.guidance

Syntax

void sendGPSLocation(Coordinate)

Parameters

Location - An object with the information about the current position.

Sample Code

// Get the GPS device
GPSDevice gpsDevice = GuidanceMgr.getGPSDevice();
boolean disableTunnelMode = false;
// Open the GPS device, but don't disable tunnel mode
gpsDevice.open(disableTunnelMode);

double latitude = 40.364992;
double longitude = -74.632334;
// Send a GPS location as an update
gpsDevice.sendGPSLocation(new Coordinate(latitude, longitude));

Related APIs

  • GPSDevice.open()
  • GPSDevice.close()
  • GPSDevice.sendNMEASentence()
  • GPSDevice.sendNMEASentenceWithOverride()

GPSDevice.sendNMEASentence (NMEA String)

Overview
Description Sends an NMEA sentence into CoPilot. Open() must be called prior to sending any locations.
Supported on Android Since Version 9.6.0.821
Type Method
Package com.alk.cpik.guidance

Syntax

void sendNMEASentence(String)

Parameters

Sentence - The NMEA sentence to send to CoPilot.

Sample Code

// Get the GPS device
GPSDevice gpsDevice = GuidanceMgr.getGPSDevice();
boolean disableTunnelMode = false;
// Open the GPS device, but don't disable tunnel mode
gpsDevice.open(disableTunnelMode);
// Send a NMEA sentence as an update
String sentenceString = "$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A";
try{
  gpsDevice.sendNMEASentence(sentenceString);
}catch(GuidanceException e){
  e.printStackTrace();
}

GPSDevice.sendNMEASentenceWithOverride (String, double)

Overview
Description Sends an NMEA sentence into CoPilot. Open() must be called prior to sending any sentences using this API. The double is used to override the speed in the input sentence with another value.
Supported on Android Since Version 9.6.0.821
Type Method
Package com.alk.cpik.guidance

Syntax

Java void sendNMEASentenceWithOverride(String, double)

Parameters

String - NMEA sentence to send.

Double - Speed, in miles per hour, to override.

Sample Code

// Get the GPS device
GPSDevice gpsDevice = GuidanceMgr.getGPSDevice();
boolean disableTunnelMode = false;

// Open the GPS device, but don't disable tunnel mode
gpsDevice.open(disableTunnelMode);

// Send a NMEA sentence as an update
String sentenceString = "$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A";
double overrideSpeedMph = 27.34;
try {
  gpsDevice.sendNMEASentenceWithOverride(sentenceString, overrideSpeedMph);
} catch (GuidanceException e) {
  e.printStackTrace();
}
  • GPSDevice.open()
  • GPSDevice.close()
  • GPSDevice.sendGPSLocation()
  • GPSDevice.sendNMEASentence()

Last update: June 8, 2020