Troubleshooting guide

204
BlackBerry Java Development Environment Development Guide
Retrieve BlackBerry device GPS location information
Task Steps
Specify a response time for retrieving the
location of the BlackBerry® device.
The time it takes to retrieve the location of the BlackBerry device for the first time depends on
several factors, such as the selected GPS mode and the GPS signal strength. In autonomous
method, typical times are less than 2 minutes. In assisted mode, typical times are less than 30
seconds.
>Invoke Criteria.setPreferredResponseTime(), providing the desired response time
in milliseconds.
Retrieve the location information for a
BlackBerry device.
> In a non-event thread, invoke LocationProvider.getLocation(int), providing a
timeout in seconds.
try {
// Specify -1 to have the implementation use its default timeout value
// for this provider.
Location location = provider.getLocation(-1);
} catch (Exception e) {
// handle LocationException, InterruptedException, SecurityException
// and IllegalArgumentException
}
Retrieve the speed of a BlackBerry
device.
1. Invoke location.getQualifiedCoordinates, storing the returned object in a
QualifiedCoordinates object.
QualifiedCoordinates coordinates = location.getQualifiedCoordinates;
2. Invoke location.getSpeed().
float speed = location.getSpeed();
Retrieve the course of a BlackBerry
device.
1. Invoke location.getQualifiedCoordinates, storing the returned object in a
QualifiedCoordinates object.
QualifiedCoordinates coordinates = location.getQualifiedCoordinates;
2. Invoke location.getCourse().
float course = location.getCourse();