Troubleshooting guide
201
14: Using location information
Use the BlackBerry Maps application
Locating BlackBerry devices using GPS information
To let your application obtain the geographical coordinates, latitude and longitude, of a BlackBerry® device, use
the Location API (javax.microedition.location). Depending on the location method you use, the application might
also retrieve the speed, orientation, and course information of a BlackBerry device.
Methods for retrieving a GPS location
Task Steps
Open the default map view. >Invoke invokeApplication() using a new MapsArguments object.
Invoke.invokeApplication( Invoke.APP_TYPE_MAPS, new MapsArguments() );
Show a location in a map. 1. Create a location string that contains location data for a location.
String document = "<location-document><location lat='-8030000'
lon='4326000' label='Kitchener, ON' description='You are here'
zoom='10'/></location-document>";
2. Invoke invokeApplication() using the APP_TYPE_MAPS constant parameter, a new
MapsArguments object that uses the ARG_LOCATION_DOCUMENT property and the location
string.
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(
MapsArguments.ARG_LOCATION_DOCUMENT, document));
Show multiple locations on a map. 1. Create a location string that contains location data for multiple locations.
String document = "<location-document>" + "<location lat='-8030000'
lon='4326000' label='Kitchener, ON'/>" + "<location lat='-7938000'
lon='4341000' label='Toronto, ON'/>"
+ "<location lat='-7540000' lon='4519000' label='Ottawa, ON'/>" + "</
location-document>";
2. Invoke invokeApplication() using the APP_TYPE_MAPS constant parameter, a new
MapsArguments object that uses the ARG_LOCATION_DOCUMENT property and the location
string.
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(
MapsArguments.ARG_LOCATION_DOCUMENT, document));
Method Constant Description
Cellsite GPS_AID_MODE_CELLSITE The cellsite method uses the GPS location of the active cellsite tower to provide first-order
GPS information.
Advantages
• Is the fastest location method.
Disadvantages
• Provides low-level accuracy location information. It does not provide orientation,
course, or speed information.
Requirements
• Requires support for network connectivity and wireless service providers.