Blackberry Java Development Environment Gps & Blackberry Maps
Blackberry Java Development Environment Gps & Blackberry Maps
Version: 4.7.0
Development Guide
Contents
1 GPS location information........................................................................................................................................................... Specifying the source of GPS location information.................................................................................................................... Get location information from cell site towers................................................................................................................... Get location information from GPS satellites using PDE.................................................................................................. Get location information from GPS satellites and the GPS receiver on a BlackBerry device....................................... Get location information from the GPS receiver on a BlackBerry device........................................................................ 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........................................................................................ Get the course of the BlackBerry device, in degrees.......................................................................................................... Get the number of GPS satellites that a BlackBerry device tracks.................................................................................. Get the time that a BlackBerry device application retrieved GPS information.............................................................. Maintain a connection with GPS satellites......................................................................................................................... Get continuous GPS readings using the cell site mode..................................................................................................... Get GPS information during a call....................................................................................................................................... Get location information updates........................................................................................................................................ Change the criteria for obtaining location information..................................................................................................... Specifying a GPS receiver as the source for location information................................................................................... 3 3 4 4 5 5 6 6 6 7 7 8 8 9 9 10 10 11 11 13 13 14 14 14 17 17 18 19 20 21 23 27 27
2 BlackBerry Maps location information..................................................................................................................................... Opening BlackBerry Maps............................................................................................................................................................. Opening BlackBerry Maps from an application.......................................................................................................................... Displaying location information on a BlackBerry device............................................................................................................ Displaying location information in BlackBerry Maps......................................................................................................... Open BlackBerry Maps to display the default map view................................................................................................... Open BlackBerry Maps to display a location on a map..................................................................................................... Open BlackBerry Maps to display multiple locations on a map....................................................................................... Open BlackBerry Maps to display a route between locations on a map......................................................................... Open BlackBerry Maps to display a custom map view...................................................................................................... Open BlackBerry Maps to display the location for an address in the contact list.......................................................... Start a BlackBerry device application from BlackBerry Maps........................................................................................... Displaying location information in a UI field............................................................................................................................... Work with a map that displays in a UI field.........................................................................................................................
Converting latitudinal and longitudinal coordinates to pixel values............................................................................... Configure the display size of a map that displays in a UI field......................................................................................... Requesting location information for an address......................................................................................................................... Retrieve location information for an address stored in address fields............................................................................. Retrieve location information for an address stored in a String....................................................................................... Cancel a request for location information for an address................................................................................................. Open BlackBerry Maps from the browser.................................................................................................................................... Clearing data from the map........................................................................................................................................................... Clear data from a map........................................................................................................................................................... 3 Resources...................................................................................................................................................................................... 4 Glossary......................................................................................................................................................................................... 5 Provide feedback......................................................................................................................................................................... 6 Legal notice..................................................................................................................................................................................
28 29 29 29 30 31 31 31 32 34 35 36 37
Development Guide
You can create a BlackBerry device application to display the current latitudinal and longitudinal position of a BlackBerry device. Depending on the mode for getting location information that you specify, the BlackBerry device application can also display information such as the speed and route information. To create a BlackBerry device application to get location information, you can use the Location API for Java ME in the javax.microedition.location package (JSR 179). The time it takes to retrieve the location of the BlackBerry device for the first time depends on several factors, such as the mode for getting location information and the GPS signal strength. In autonomous mode, typical times are less than 2 minutes. In assisted mode, typical times are less than 30 seconds. To retrieve and display GPS location information, the BlackBerry device must support GPS technology and a valid SIM card must be inserted in the BlackBerry device.
Related topics Specifying the source of GPS location information, 3 BlackBerry Maps location information, 13
Development Guide
2. 3. 4. 5. 6. 7.
Invoke criteria.setHorizontalAccuracy(NO_REQUIREMENT) to specify that longitudinal accuracy is not required. Invoke criteria.setVerticalAccuracy(NO_REQUIREMENT) to specify that latitudinal accuracy is not required. Invoke criteria.setCostAllowed(true) to specify that this mode can incur cost. Invoke setPreferredPowerConsumption(POWER_USAGE_LOW) to specify that power consumption is low. Invoke LocationProvider.getInstance(), storing the returned object in a LocationProvider object.
LocationProvider provider = LocationProvider.getInstance(criteria);
Related topics Get location information from GPS satellites using PDE, 4 Get location information from GPS satellites and the GPS receiver on a BlackBerry device, 5
2. 3. 4. 5. 6. 7.
Invoke criteria.setHorizontalAccuracy(NO_REQUIREMENT) to specify that longitudinal accuracy is not required. Invoke criteria.setVerticalAccuracy(NO_REQUIREMENT) to specify that latitudinal accuracy is not required. Invoke criteria.setCostAllowed(true) to specify that this mode can incur cost. Invoke criteria.setPreferredPowerConsumption(int level) using either POWER_USAGE_MEDIUM, or NO_REQUIREMENT as the parameter to specify power consumption is medium or not required. Invoke LocationProvider.getInstance(), storing the returned object in a LocationProvider object.
LocationProvider provider = LocationProvider.getInstance(criteria);
Related topics Get location information from cell site towers, 4 Get location information from GPS satellites and the GPS receiver on a BlackBerry device, 5
Development Guide
Get location information from GPS satellites and the GPS receiver on a BlackBerry device
1. Import the following classes: javax.microedition.location.LocationProvider javax.microedition.location.Criteria Create an instance of a Criteria object.
Criteria criteria = new Criteria();
2. 3. 4.
Invoke criteria.setCostAllowed(false) to specify that this mode does not incur cost. Invoke LocationProvider.getInstance(), storing the returned object in a LocationProvider object.
LocationProvider provider = LocationProvider.getInstance(criteria);
Related topics Get location information from cell site towers, 4 Get location information from GPS satellites using PDE, 4 Get location information from the GPS receiver on a BlackBerry device, 5
2. 3.
Complete one of the following tasks to get location information using the GPS receiver on a BlackBerry device: Task Steps Invoke criteria.setHorizontalAccuracy(int accuracy) using an integer value that represents the accuracy, in meters. Invoke criteria.setVerticalAccuracy(int accuracy) using an integer value that represents the accuracy, in meters. Invoke criteria.setCostAllowed(false). Invoke criteria.setHorizontalAccuracy(int accuracy) using an integer value that represents the accuracy, in meters. Invoke criteria.setVerticalAccuracy(int accuracy) using an integer value that represents the accuracy, in meters. Invoke criteria.setCostAllowed(true).
Specify a level of accuracy, a. with no cost and no power consumption. b. c. Specify a level of accuracy, a. with cost and variable power consumption. b. c.
Development Guide
Task
Steps d. Invoke criteria.setPreferredPowerConsumption(int level) using either POWER_USAGE_LOW, POWER_USAGE_MEDIUM, or NO_REQUIREMENT as the parameter. Invoke criteria.setHorizontalAccuracy(NO_REQUIREMENT). Invoke criteria.setVerticalAccuracy(NO_REQUIREMENT). Invoke criteria.setCostAllowed(false). Invoke criteria.setPreferredPowerConsumption(int level) using either POWER_USAGE_MEDIUM, POWER_USAGE_HIGH, or NO_REQUIREMENT as the parameter.
4.
Related topics Get location information from GPS satellites and the GPS receiver on a BlackBerry device, 5
Specify a response time for getting the location of the BlackBerry device
1. 2. 3. Import the javax.microedition.location.Criteria class. Create an instance of a Criteria object.
Criteria criteria = new Criteria();
Related topics Get the time that a BlackBerry device application retrieved GPS information, 8 Get continuous GPS readings using the cell site mode, 9
2.
Development Guide
3.
Related topics Get the speed of the BlackBerry device, in meters per second, 7 Get the course of the BlackBerry device, in degrees, 7
2. 3. 4.
Invoke LocationProvider.getLocation() and assign the value that the method returns to a Location variable.
Location mylocation = provider.getLocation(-1);
Invoke Location.getSpeed() and save the value that the method returns to a float variable.
float speed = mylocation.getSpeed();
Related topics Get the location information for a BlackBerry device, 6 Get the course of the BlackBerry device, in degrees, 7
2. 3. 4.
Invoke LocationProvider.getLocation() and assign the value that the method returns to a Location variable.
Location mylocation = provider.getLocation(-1);
Invoke location.getCourse() and save the value that the method returns to a float variable.
float course = mylocation.getCourse();
Development Guide
Related topics Get the location information for a BlackBerry device, 6 Get the speed of the BlackBerry device, in meters per second, 7
2. 3. 4.
Invoke LocationProvider.getLocation() and assign the value that the method returns to a Location variable.
Location mylocation = provider.getLocation(-1);
Invoke the Location.getExtraInfo() method using the NMEA MIME type as a parameter. The method returns an encoded String that contains information about the number of GPS satellites.
String encodedStr = mylocation.getExtraInfo("application/X-jsr179-location-nmea");
5.
To retrieve the GPS satellite information, parse through the information in the returned String value.
Get the time that a BlackBerry device application retrieved GPS information
1. Import the following classes: javax.microedition.location.LocationProvider javax.microedition.location.Location Create an instance of a LocationProvider.
LocationProvider provider = new LocationProvider();
2. 3. 4.
Invoke LocationProvider.getLocation() and assign the value that the method returns to a Location variable.
Location mylocation = provider.getLocation(-1);
Invoke Location.getTimeStamp() and assign the value that the method returns to a long variable. The time is retrieved from the GPS receiver on the BlackBerry device.
long timestamp = myLocation.getTimeStamp();
Related topics Specify a response time for getting the location of the BlackBerry device, 6 Get continuous GPS readings using the cell site mode, 9
Development Guide
Invoke LocationProvider.getInstance() using the Criteria object as a parameter and assign the value that the method returns to a LocationProvider variable.
LocationProvider provider = LocationProvider.getInstance(criteria);
6.
Invoke LocationProvider.setLocationListener() to configure a LocationListener with an interval value that is less than 10 seconds.
provider.setLocationListener(loclistener, 9, -1, -1);
Related topics Get the number of GPS satellites that a BlackBerry device tracks, 8
2. 3.
Invoke the LocationProvider.getLocation() method within code that simulates the retrieval of GPS information at fixed intervals. Assign the value that the method returns to a Location variable.
Location loc = provider.getLocation(-1);
Related topics Specify a response time for getting the location of the BlackBerry device, 6 Get the time that a BlackBerry device application retrieved GPS information, 8
Development Guide
2. 3. 4.
Configure the Criteria object to obtain GPS information without using a wireless network. Invoke Criteria.setCostAllowed() using the boolean value of false as a parameter to configure that cost cannot be incurred.
criteria.setCostAllowed(false);
5.
Invoke the LocationProvider.getInstance() method using a Criteria object as a parameter that you configure to obtain GPS information without using a a wireless network. Assign the value that the method returns to a LocationProvider variable.
LocationProvider provider = LocationProvider.getInstance(criteria);
6.
Invoke LocationProvider.setLocationListener() using an instance of the class that implements the LocationListener interface as a parameter to register your implementation.
provider.setLocationListener(loclistener, 9, -1, -1);
10
Development Guide
2. 3. 4. 5. 6.
Invoke the setHorizontalAccuracy(), setVerticalAccuracy(), setCostAllowed(), and setPreferredPowerConsumption() methods of the new Criteria object to specify the new criteria. Invoke LocationProvider.reset() using the LocationProvider object with the criteria that you want to change.
provider.reset();
7.
Specify the LocationListener to null to unregister any LocationListeners that are currently associated with the LocationProvider.
provider.setLocationListener(null, -1, -1, -1);
8.
Invoke LocationProvider.getInstance() using the new Criteria object as a parameter to create a new instance of a LocationProvider. Assign the value that the method returns to the LocationProvider object with the criteria that you want to change.
provider = LocationProvider.getInstance(criteria);
9.
Invoke LocationProvider.setLocationListener() to associate a new LocationListener with the LocationProvider. provider.setLocationListener(locListener, -1, -1, -1);
11
Development Guide
Criteria A BlackBerry device that is running BlackBerry Device Software version 4.2 or later that does not have an internal GPS receiver and is paired with one or more Bluetooth enabled GPS receivers A BlackBerry device that is running BlackBerry Device Software version 4.2 or later that has an internal GPS receiver and is paired with one or more Bluetooth enabled GPS receivers A BlackBerry device that is running BlackBerry Device Software version 4.2 or later that has an internal GPS receiver and is paired with only one Bluetooth enabled GPS receiver A BlackBerry device that is running BlackBerry Device Software version 4.2 or later that has an internal GPS receiver and is not paired with a Bluetooth enabled GPS receiver
Source of location information for the Location API one of the Bluetooth enabled GPS receivers
12
Development Guide
You can create a BlackBerry device application that interacts with BlackBerry Maps. The BlackBerry Maps is a map and location client application that can display a map for a location, the location of the BlackBerry device, a route from a starting location to a specific ending location, and points of interest on a map. The BlackBerry Maps uses latitudinal and longitudinal integer values that are 100,000 times the double values specified by JSR 179, which uses WGS 84 specifications for the longitudinal and latitudinal values. To create a BlackBerry device application that uses BlackBerry Maps, you can use the MapArguments class in the net.rim.blackberry.api.invoke package. A BlackBerry device application can interact with the BlackBerry Maps in the following ways: start the BlackBerry Maps from a BlackBerry device application add a menu item to the BlackBerry Maps that opens a BlackBerry device application
The BlackBerry Maps is included on BlackBerry devices that run BlackBerry Device Software version 4.2 or later.
Related topics GPS location information, 3 Specifying the source of GPS location information, 3
location information. BlackBerry Maps. starts and displays the information in the location document.
13
Development Guide
Description You can let aBlackBerry device user use the browser on a BlackBerry device to access location information on a web server and display that information in BlackBerry Maps. You create a file with the extension .xloc and place location information in the file. The location information is the same information that you assign to the location document to start BlackBerry Maps from a BlackBerry device application. You then place the .xloc file on a web server. When a BlackBerry device user accesses the link for the .xloc file, for example http://servername/Filename.xloc, the browser passes the .xloc file as a String to the location document parser. BlackBerry Maps starts and displays the information in the .xloc file.
Related topics Opening BlackBerry Maps from an application, 14 Open BlackBerry Maps from the browser, 31
14
Development Guide
Attribute
id clear
Type
String String
Description the id of a location document the action to perform on the information in a map NONE: clears no information DOCS: clears location or route information from all location documents with a id attribute set to a value LOCATIONS: clears location information from the map ALL: clears location and route information from the map
Required no no
15
Development Guide
Type
integer integer integer String
Description latitude in decimal degrees x 100,000 longitude in decimal degrees x 100,000 zoom level from 0 to MAX_ZOOM a label that is displayed beside a location on a map description information for a location address city province or state country postal code phone number fax number URL email address category rating information, between 0 and 5
description address city region country postalCode phone fax url email categories rating
String String String String String String String String String String String String
yes no no no no no no no no no no no
4.2.0 or later 4.2.1 or later 4.2.1 or later 4.2.1 or later 4.2.1 or later 4.2.1 or later 4.2.1 or later 4.2.1 or later 4.2.1 or later 4.2.1 or later 4.2.1 or later 4.2.1 or later
16
Development Guide
3.
2.
Related topics View a sample application that displays the default map, 17
Related topics Open BlackBerry Maps to display the default map view, 17
17
Development Guide
net.rim.blackberry.api.invoke.Invoke net.rim.blackberry.api.invoke.MapsArguments 2. Create a String that contains location information for one location.
String document = "<location-document><location lon='-8052237' lat='4346518' label='Waterloo, ON' description='Waterloo' zoom='10'/></location-document>";
3.
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));
18
Development Guide
2.
3.
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));
Related topics View a sample application that displays multiple locations on a map, 19
2.
19
Development Guide
String document = "<location-document><GetRoute>" + "<location lon='-8052237' lat='4346518' label='Waterloo, ON' description='Waterloo, Ontario, Canada' />" + "<location lon='-7569792' lat='4542349' label='Ottawa, ON' description='Ottawa, Ontario, Canada' />" + "</GetRoute></location-document>";
3.
Invoke invokeApplication() using the APP_TYPE_MAPS constant parameter, a new MapsArguments object that uses the ARG_LOCATION_DOCUMENT property, and the String.
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments ( MapsArguments.ARG_LOCATION_DOCUMENT,document));
Related topics View a sample application that displays a route between locations on a map, 20
Related topics Open BlackBerry Maps to display a route between locations on a map, 19
20
Development Guide
2. 3.
Modify the latitude, longitude, and zoom values for the MapView object.
mapView.setLatitude(4331168); mapView.setLongitude(-8055339); mapView.setZoom(10);
4.
Invoke invokeApplication() using the APP_TYPE_MAPS constant parameter, and a new MapsArguments object that uses the MapView object you created.
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(mapView));
Related topics View a sample application that displays a custom map view, 21
Open BlackBerry Maps to display the location for an address in the contact list
You can create a BlackBerry Application that displays a map for the address of a contact in the contact list. The address for the contact must be a valid address. 1. Import the following classes: javax.microedition.pim.PIM net.rim.blackberry.api.invoke.Invoke net.rim.blackberry.api.invoke.MapsArguments javax.microedition.pim.PIMException 2. Import the following interfaces: javax.microedition.pim.Contact javax.microedition.pim.ContactList java.util.Enumeration Implement the following interfaces: javax.microedition.pim.Contact javax.microedition.pim.ContactList java.util.Enumeration
3.
21
Development Guide
4. 5.
6.
7.
Create a While loop to iterate through all the items in the enumeration.
while ((enumContact.hasMoreElements()) && ( notFinished == 1)) { c = (Contact)enumContact.nextElement(); int[] fieldIds = c.getFields(); int id;
8.
Search for the first contact with a valid city and region and display the address information for this contact in the BlackBerry Maps.
if (c.countValues(Contact.ADDR) > 0) { String address[] = c.getStringArray(Contact.ADDR,0); if ((address[Contact.ADDR_LOCALITY] != null) && (address[Contact.ADDR_REGION] != null)) { Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(c,0)); notFinished = 0; } } } } catch (PIMException e) { }
9.
If a contact address is not found, display the default map in the BlackBerry Maps.
if == null) { Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments()); } } };
Related topics View a sample application that displays the location for an address in the contact list, 22
View a sample application that displays the location for an address in the contact list
Before you begin: On a BlackBerry device, open the contact list. If there are no addresses in the contact list, the sample will display the default view in the BlackBerry Maps.
22
Development Guide
1. 2. 3. 4. 5.
Open the BlackBerry Integrated Development Environment. Launch the BlackBerryMapsDemo project. In the BlackBerry Smartphone Simulator, click BlackBerry Maps Demo. Open the menu and click Invoke Contact. Open the menu and click View Map.
Related topics Open BlackBerry Maps to display the location for an address in the contact list, 21
10. Create a class that extends the ApplicationMenuItem class and implements the run() and toString() methods.
private static class MapsMenuItem extends ApplicationMenuItem { MapsMenuItem() { super(20); } public String toString()
23
Development Guide
{ return "Menu Item Demo"; } public Object run(Object context) { if (context instanceof MapView ) { _mv = (MapView)context; UiApplication app = UiApplication.getUiApplication(); app.pushScreen( new MapsMenuItemScreen(_mv) ); app.requestForeground(); } return null; } } }
11.
24
Development Guide
final class MapsMenuItemScreen extends MainScreen { private MapView _mapview; private BasicEditField _latitudeField; private BasicEditField _logitudeField; private NumericChoiceField _zoomField; MapsMenuItemScreen(MapView _mv) { _mapview = _mv; _latitudeField = new BasicEditField ("Latitude: " , _mv.getLatitude() /100000.0 + "" , 9 , BasicEditField.FILTER_REAL_NUMERIC ); _logitudeField = new BasicEditField ("Longitude: ",_mv.getLongitude() /100000.0 + "" , 10 , BasicEditField.FILTER_REAL_NUMERIC); _zoomField = new NumericChoiceField ("Zoom: " , 0 , MapView.MAX_ZOOM , 1 , _mv.getZoom()); add(_latitudeField); add(_logitudeField); add(_zoomField); add(new SeparatorField()); add(new RichTextField("Edit latitude, longitude and zoom level settings and select View Map from the menu." , Field.NON_FOCUSABLE)); addMenuItem(viewMapItem); setTitle("Location Details Screen"); }
13. Create a menu item that displays the latitude, longitude, and zoom values from the MapView context object.
private MenuItem viewMapItem = new MenuItem("View Map", 1000, 10) { public void run() { _mapview.setZoom( _zoomField.getSelectedValue() ); try { int latitude = (int) (100000 * Double.parseDouble (_latitudeField.getText())); int longitude = (int) (100000 * Double.parseDouble (_logitudeField.getText())); if (latitude > 9000000 || latitude < -9000000 ||
25
Development Guide
longitude >= 18000000 || longitude < -18000000) { throw new IllegalArgumentException (); } _mapview.setLatitude(latitude); _mapview.setLongitude(longitude); Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(_mapview)); close(); } catch(RuntimeException re) { Dialog.alert("Invalid Longitude and/or Latitude"); _latitudeField.setFocus(); } } };
View a sample application that starts a BlackBerry Application from BlackBerry Maps
1. 2. 3. 4. From the BlackBerry Integrated Development Environment, launch the BlackBerry Smartphone Simulator. In the BlackBerry Smartphone Simulator, launchBlackBerry Maps. In BlackBerry Maps, click Menu Item Demo. Complete the instructions on the screen and click View Map.
26
Development Guide
Description Modify the center of a map in a UI field using latitudinal and longitudinal values, in degrees. The latitude and longitude values are calculated as degrees multiplied by 100,000. Modify the center of a map in a UI field using specific coordinates.
MapField.setZoom(int z)
Modify the center of a map in a UI field using pixel values. The move(dx,dy) method moves the center of the map in terms of relative pixels. A positive dx moves the center of the map east if the rotation is 0, and a positive dy moves the center of the map north if the rotation is 0. Modify the zoom value for a map in a UI field. Zoom values can be from 0 to 15. The zoom operation is performed to the center of the map in the MapField.
27
Development Guide
Method
MapField.setRotation(int r)
Description Modify the rotation for a map in a UI field, in degrees. Rotation can range from 0 to 360, clockwise. A rotation setting of 0 specifies north at the top of the map view. Retrieve the latitude of the center of a map in a UI field. Retrieve the longitude of the center of a map in a UI field. Retrieve the zoom value of a map in a UI field. Retrieve the rotation setting for a map in a UI field.
Related topics Displaying location information in a UI field, 27 Configure the display size of a map that displays in a UI field, 29
28
Development Guide
3.
29
Development Guide
4.
Create a Coordinates object that the location-based services locator server uses as a starting location to search for location information for an address.
Coordinates co = new Coordinates(43.46518, -80.52237, 0);
5.
Invoke Locator.geocode(AddressInfo address, Coordinates startCoords) and assign the value that the method returns to a Landmark array.
Landmark[] lm = Locator.geocode(ai,co);
2. 3.
4.
Invoke Locator.geocode(String freeformString, Coordinates startCoords) and assign the value that the method returns to a Landmark array.
Landmark[] = Locator.geocode(sAddress, co);
Related topics Retrieve location information for an address stored in address fields, 29
30
Development Guide
3. 4.
On a web server, place the .xloc file in the folder where you store .html files. Register the following MIME type with the web server: text/vnd.rim.location xloc.
Related topics Opening BlackBerry Maps, 13 Opening BlackBerry Maps from an application, 14
When you send the location document for Kitchener, Ontario to BlackBerry Maps, BlackBerry Maps displays the information for Kitchener, Ontario. To remove the information for Kitchener, Ontario from BlackBerry Maps, in the next location document you send to BlackBerry Maps, configure the clear attribute to the value of the id attribute of the location document that contains information for Kitchener.
31
Development Guide
String document = "<lbs clear='Wat' ><location lon='-8052237' lat='4346518' label='Waterloo, ON' description='Waterloo' zoom='10'/></lbs>";
When you send the new location document to BlackBerry Maps, BlackBerry Maps removes the Kitchener data from the map.
Related topics Clear data from a map, 32
1.
Import the following classes: java.lang.String net.rim.blackberry.api.invoke.Invoke Perform one of the following tasks: Task Clear data from a location document with an id attribute Step Create a String that configures the clear attribute to the id of the location document that contains the data to remove from a map.
String document = "<lbs clear='Montreal' ><location lon='-8052237' lat='4346518' label='Waterloo, ON' description='Waterloo' zoom='10'/></lbs>";
2.
Create a String that configures the clear attribute to a commadelimited list of ids.
String document = "<lbs clear='MONTREAL','OTTAWA' ><location lon='-8052237' lat='4346518' label='Waterloo, ON' description='Waterloo' zoom='10'/></lbs>";
32
Development Guide
Task
Step
String document = "<lbs clear='Locations' ><location lon='-8052237' lat='4346518' label='Waterloo, ON' description='Waterloo' zoom='10'/></lbs>";
3.
33
Development Guide
Resources
Resources
For more information about APIs and GPS, visit www.blackberry.com/developers.
To view complete code samples for the BlackBerry Java Development Environment, visit www.blackberry.com/developers.
34
Development Guide
Glossary
Glossary
API application programming interface GPS Global Positioning System JSR Java Specification Request MIME Multipurpose Internet Mail Extensions NMEA National Marine Electronics Association PDE Position Determination Entity SIM Subscriber Identity Module WGS World Geodetic System XML Extensible Markup Language
35
Development Guide
Provide feedback
Provide feedback
To provide feedback on this deliverable, visit www.blackberry.com/docsfeedback.
36
Development Guide
Legal notice
Legal notice
2009 Research In Motion Limited. All rights reserved. BlackBerry, RIM, Research In Motion, SureType, SurePress and related trademarks, names, and logos are the property of Research In Motion Limited and are registered and/or used in the U.S. and countries around the world. Bluetooth is a trademark of Bluetooth SIG. Java is a trademark of Sun Microsystems, Inc. All other trademarks are the property of their respective owners. The BlackBerry smartphone and other devices and/or associated software are protected by copyright, international treaties, and various patents, including one or more of the following U.S. patents: 6,278,442; 6,271,605; 6,219,694; 6,075,470; 6,073,318; D445,428; D433,460; D416,256. Other patents are registered or pending in the U.S. and in various countries around the world. Visit www.rim.com/patents for a list of RIM (as hereinafter defined) patents. This documentation including all documentation incorporated by reference herein such as documentation provided or made available at www.blackberry.com/go/docs is provided or made accessible "AS IS" and "AS AVAILABLE" and without condition, endorsement, guarantee, representation, or warranty of any kind by Research In Motion Limited and its affiliated companies ("RIM") and RIM assumes no responsibility for any typographical, technical, or other inaccuracies, errors, or omissions in this documentation. In order to protect RIM proprietary and confidential information and/or trade secrets, this documentation may describe some aspects of RIM technology in generalized terms. RIM reserves the right to periodically change information that is contained in this documentation; however, RIM makes no commitment to provide any such changes, updates, enhancements, or other additions to this documentation to you in a timely manner or at all. This documentation might contain references to third-party sources of information, hardware or software, products or services including components and content such as content protected by copyright and/or third-party web sites (collectively the "Third Party Products and Services"). RIM does not control, and is not responsible for, any Third Party Products and Services including, without limitation the content, accuracy, copyright compliance, compatibility, performance, trustworthiness, legality, decency, links, or any other aspect of Third Party Products and Services. The inclusion of a reference to Third Party Products and Services in this documentation does not imply endorsement by RIM of the Third Party Products and Services or the third party in any way. EXCEPT TO THE EXTENT SPECIFICALLY PROHIBITED BY APPLICABLE LAW IN YOUR JURISDICTION, ALL CONDITIONS, ENDORSEMENTS, GUARANTEES, REPRESENTATIONS, OR WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY CONDITIONS, ENDORSEMENTS, GUARANTEES, REPRESENTATIONS OR WARRANTIES OF DURABILITY, FITNESS FOR A PARTICULAR PURPOSE OR USE, MERCHANTABILITY, MERCHANTABLE QUALITY, NONINFRINGEMENT, SATISFACTORY QUALITY, OR TITLE, OR ARISING FROM A STATUTE OR CUSTOM OR A COURSE OF DEALING OR USAGE OF TRADE, OR RELATED TO THE DOCUMENTATION OR ITS USE, OR PERFORMANCE OR NON-PERFORMANCE OF ANY SOFTWARE, HARDWARE, SERVICE, OR ANY THIRD PARTY PRODUCTS AND SERVICES REFERENCED HEREIN, ARE HEREBY EXCLUDED. YOU MAY ALSO HAVE OTHER RIGHTS THAT VARY BY STATE OR PROVINCE. SOME JURISDICTIONS MAY NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES AND CONDITIONS. TO THE EXTENT PERMITTED BY LAW, ANY IMPLIED WARRANTIES OR CONDITIONS RELATING TO THE DOCUMENTATION TO THE EXTENT THEY CANNOT BE EXCLUDED AS SET OUT ABOVE, BUT CAN BE LIMITED, ARE HEREBY LIMITED TO NINETY (90) DAYS FROM THE DATE YOU FIRST ACQUIRED THE DOCUMENTATION OR THE ITEM THAT IS THE SUBJECT OF THE CLAIM.
37
Development Guide
Legal notice
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW IN YOUR JURISDICTION, IN NO EVENT SHALL RIM BE LIABLE FOR ANY TYPE OF DAMAGES RELATED TO THIS DOCUMENTATION OR ITS USE, OR PERFORMANCE OR NONPERFORMANCE OF ANY SOFTWARE, HARDWARE, SERVICE, OR ANY THIRD PARTY PRODUCTS AND SERVICES REFERENCED HEREIN INCLUDING WITHOUT LIMITATION ANY OF THE FOLLOWING DAMAGES: DIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, INDIRECT, SPECIAL, PUNITIVE, OR AGGRAVATED DAMAGES, DAMAGES FOR LOSS OF PROFITS OR REVENUES, FAILURE TO REALIZE ANY EXPECTED SAVINGS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, LOSS OF BUSINESS OPPORTUNITY, OR CORRUPTION OR LOSS OF DATA, FAILURES TO TRANSMIT OR RECEIVE ANY DATA, PROBLEMS ASSOCIATED WITH ANY APPLICATIONS USED IN CONJUNCTION WITH RIM PRODUCTS OR SERVICES, DOWNTIME COSTS, LOSS OF THE USE OF RIM PRODUCTS OR SERVICES OR ANY PORTION THEREOF OR OF ANY AIRTIME SERVICES, COST OF SUBSTITUTE GOODS, COSTS OF COVER, FACILITIES OR SERVICES, COST OF CAPITAL, OR OTHER SIMILAR PECUNIARY LOSSES, WHETHER OR NOT SUCH DAMAGES WERE FORESEEN OR UNFORESEEN, AND EVEN IF RIM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW IN YOUR JURISDICTION, RIM SHALL HAVE NO OTHER OBLIGATION, DUTY, OR LIABILITY WHATSOEVER IN CONTRACT, TORT, OR OTHERWISE TO YOU INCLUDING ANY LIABILITY FOR NEGLIGENCE OR STRICT LIABILITY. THE LIMITATIONS, EXCLUSIONS, AND DISCLAIMERS HEREIN SHALL APPLY: (A) IRRESPECTIVE OF THE NATURE OF THE CAUSE OF ACTION, DEMAND, OR ACTION BY YOU INCLUDING BUT NOT LIMITED TO BREACH OF CONTRACT, NEGLIGENCE, TORT, STRICT LIABILITY OR ANY OTHER LEGAL THEORY AND SHALL SURVIVE A FUNDAMENTAL BREACH OR BREACHES OR THE FAILURE OF THE ESSENTIAL PURPOSE OF THIS AGREEMENT OR OF ANY REMEDY CONTAINED HEREIN; AND (B) TO RIM AND ITS AFFILIATED COMPANIES, THEIR SUCCESSORS, ASSIGNS, AGENTS, SUPPLIERS (INCLUDING AIRTIME SERVICE PROVIDERS), AUTHORIZED RIM DISTRIBUTORS (ALSO INCLUDING AIRTIME SERVICE PROVIDERS) AND THEIR RESPECTIVE DIRECTORS, EMPLOYEES, AND INDEPENDENT CONTRACTORS. IN ADDITION TO THE LIMITATIONS AND EXCLUSIONS SET OUT ABOVE, IN NO EVENT SHALL ANY DIRECTOR, EMPLOYEE, AGENT, DISTRIBUTOR, SUPPLIER, INDEPENDENT CONTRACTOR OF RIM OR ANY AFFILIATES OF RIM HAVE ANY LIABILITY ARISING FROM OR RELATED TO THE DOCUMENTATION. Prior to subscribing for, installing, or using any Third Party Products and Services, it is your responsibility to ensure that your airtime service provider has agreed to support all of their features. Some airtime service providers might not offer Internet browsing functionality with a subscription to the BlackBerry Internet Service. Check with your service provider for availability, roaming arrangements, service plans and features. Installation or use of Third Party Products and Services with RIM's products and services may require one or more patent, trademark, copyright, or other licenses in order to avoid infringement or violation of third party rights. You are solely responsible for determining whether to use Third Party Products and Services and if any third party licenses are required to do so. If required you are responsible for acquiring them. You should not install or use Third Party Products and Services until all necessary licenses have been acquired. Any Third Party Products and Services that are provided with RIM's products and services are provided as a convenience to you and are provided "AS IS" with no express or implied conditions, endorsements, guarantees, representations, or warranties of any kind by RIM and RIM assumes no liability whatsoever, in relation thereto. Your use of Third Party Products and Services shall be governed by and subject to you agreeing to the terms of separate licenses and other agreements applicable thereto with third parties, except to the extent expressly covered by a license or other agreement with RIM. Certain features outlined in this documentation require a minimum version of BlackBerry Enterprise Server, BlackBerry Desktop Software, and/or BlackBerry Device Software.
38
Development Guide
Legal notice
The terms of use of any RIM product or service are set out in a separate license or other agreement with RIM applicable thereto. NOTHING IN THIS DOCUMENTATION IS INTENDED TO SUPERSEDE ANY EXPRESS WRITTEN AGREEMENTS OR WARRANTIES PROVIDED BY RIM FOR PORTIONS OF ANY RIM PRODUCT OR SERVICE OTHER THAN THIS DOCUMENTATION. Research In Motion Limited 295 Phillip Street Waterloo, ON N2L 3W8 Canada Research In Motion UK Limited Centrum House 36 Station Road Egham, Surrey TW20 9LF United Kingdom Published in Canada
39