Blackberry GPS and BlackBerry Maps Manual - Page 28
Browse online or download pdf Manual for Software Blackberry GPS and BlackBerry Maps. Blackberry GPS and BlackBerry Maps 35 pages. Version: 4.7.0
Development Guide
Retrieve location information for an address stored in a String
1.
Create a String object that contains address information.
String Address = "Toronto, Canada";
2.
Create a Coordinates object that the locator server for location-based services uses as a starting location to search
for location information for an address.
Coordinates co = new Coordinates(45.423488, -75.697929, 0);
3.
Create a Locator object.
Locator lo = new Locator();
4.
Invoke Locator.geocode(String freeformString, Coordinates startCoords).
Enumeration en = lo.geocode(sAddress, co);
Cancel a request for location information for an address
Invoke Locator.cancel().
lo.cancel();
Determine why a request for location information was unsuccessful
1.
In your code, create a try block for a LocationException.
2.
After the try block, create a catch block that invokes LocationException.getErrorCode().
try {
} catch (LocationException e) {
System.err.println("LocationException: "
}
Open BlackBerry Maps from the browser
A BlackBerry® device user can use the browser on a BlackBerry device to access location information on a web server and display
that information in BlackBerry Maps. You store location information in .xloc files and place the .xloc files on a web server. When
a BlackBerry device user accesses the link for the .xloc file, for example http://servername/Filename.xloc, the browser opens
BlackBerry Maps to display the location information. The browser passes the .xloc file as a String to the location document
parser.
1.
Create a file with the extension .xloc.
2.
Place the information that you would normally place in a location document in the .xloc file. The location document
information is the same information you assign to the String variable location document.
"<lbs><location lon='-7938675' lat='4367022' label='Toronto, ON'
description='Toronto' zoom='10'/></lbs>";
26
+ e.getErrorCode());
Open BlackBerry Maps from the browser