Getting Gps Location Information; Specify A Response Time For Getting The Location Of The Blackberry Device; Get The Location Information For A Blackberry Device; Get The Speed Of The Blackberry Device, In Meters Per Second - Blackberry JAVA DEVELOPMENT ENVIRONMENT - - GPS AND MAPS - DEVELOPMENT GUIDE Manual

Version: 4.7.0
Table of Contents

Advertisement

Development Guide
Task
Specify a level of accuracy,
with no cost and variable
power consumption.
3.
Invoke LocationProvider.getInstance(), storing the returned object in a LocationProvider object.
LocationProvider provider = LocationProvider.getInstance(criteria);

Getting GPS location information

Specify a response time for getting the location of the BlackBerry device

Invoke Criteria.setPreferredResponseTime(), and specify the response time, in milliseconds.

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

Get the speed of the BlackBerry device, in meters per second

Invoke location.getSpeed().
Location location = provider.getLocation(-1);
float speed = mylocation.getSpeed();
6
Steps
a.
Invoke criteria.setHorizontalAccuracy(NO_REQUIREMENT).
b.
Invoke criteria.setVerticalAccuracy(NO_REQUIREMENT).
c.
Invoke criteria.setCostAllowed(false).
d.
Invoke
criteria.setPreferredPowerConsumption(int level) using
one of POWER_USAGE_MEDIUM, POWER_USAGE_HIGH, or
NO_REQUIREMENT as the parameter.
Getting GPS location information

Advertisement

Table of Contents
loading

This manual is also suitable for:

Gps and blackberry maps

Table of Contents