Blackberry JAVA DEVELOPMENT ENVIRONMENT - - GPS AND  MAPS - DEVELOPMENT GUIDE Manual
Blackberry JAVA DEVELOPMENT ENVIRONMENT - - GPS AND  MAPS - DEVELOPMENT GUIDE Manual

Blackberry JAVA DEVELOPMENT ENVIRONMENT - - GPS AND MAPS - DEVELOPMENT GUIDE Manual

Version: 4.7.0
Table of Contents

Advertisement

Quick Links

GPS and BlackBerry Maps
Version: 4.7.0
Development Guide

Advertisement

Table of Contents
loading

Summary of Contents for Blackberry JAVA DEVELOPMENT ENVIRONMENT - - GPS AND MAPS - DEVELOPMENT GUIDE

  • Page 1 GPS and BlackBerry Maps Version: 4.7.0 Development Guide...
  • Page 2 SWD-596846-1209055709-001...
  • Page 3: Table Of Contents

    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................
  • Page 4 Retrieve location information for an address stored in a String..................Cancel a request for location information for an address....................Determine why a request for location information was unsuccessful................Open BlackBerry Maps from the browser............................ Clearing data from the map................................Clear data from a location document with an id attribute....................
  • Page 5: Gps Location Information

    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.
  • Page 6: Get Location Information From Gps Satellites Using Pde

    Invoke LocationProvider.getInstance(), storing the returned object in a LocationProvider object. LocationProvider provider = LocationProvider.getInstance(criteria); Get location information from GPS satellites and the GPS receiver on a BlackBerry device Create an instance of a Criteria object. Criteria criteria = new Criteria();...
  • Page 7: Get Location Information From The Gps Receiver On A Blackberry Device

    Get location information from the GPS receiver on a BlackBerry device Create an instance of a Criteria object. Criteria criteria = new Criteria(); Complete one of the following tasks to get location information using the GPS receiver on a BlackBerry device : Task Steps Specify a level of accuracy, Invoke criteria.setHorizontalAccuracy(int accuracy) using...
  • Page 8: Getting Gps Location Information

    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.
  • Page 9: Get The Course Of The Blackberry Device, In Degrees

    Maintain a connection with GPS satellites You can configure a BlackBerry® device application to query the Location API for GPS location information in an interval less than 10 seconds. Define a LocationListener with an interval value that is less than 10 seconds.
  • Page 10: Get Location Information Updates

    Get location information updates You can associate only one LocationListener object with a particular provider for GPS location information. The BlackBerry® device application typically listens for updates on a separate thread. Implement the LocationListener interface. To register your implementation, invoke LocationProvider.setLocationListener().
  • Page 11: Blackberry Maps Location Information

    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.
  • Page 12 Development Guide Displaying location information on a BlackBerry device BlackBerry Java Attribute Type Description Required Development Environment version 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...
  • Page 13 Development Guide Displaying location information on a BlackBerry device BlackBerry Java Attribute Type Description Required Development Environment version String label a label that is displayed 4.2.0 or later beside a location on a description String description information 4.2.0 or later...
  • Page 14: Open Blackberry Maps To Display The Default Map View

    Invoke invokeApplication()using a new MapsArguments object that does not contain any arguments. View a sample application that displays the default map From the BlackBerry® Integrated Development Environment, launch the BlackBerryMapsDemo project. In the BlackBerry Smartphone Simulator, click BlackBerry Maps Demo.
  • Page 15: Open Blackberry Maps To Display A Location On A Map

    Development Guide Displaying location information on a BlackBerry device Open BlackBerry Maps to display a location on a map Import the following classes: • net.rim.blackberry.api.invoke.Invoke • net.rim.blackberry.api.invoke.MapsArguments Create a String that contains location information for one location. String document = "<location-document><location lon='-7938675' lat='4367022' label='Toronto, ON' description='Toronto' zoom='10'/></...
  • Page 16: Open Blackberry Maps To Display Multiple Locations On A Map

    Displaying location information on a BlackBerry device View a sample application that displays a location on a map From the BlackBerry® Integrated Development Environment, launch the BlackBerryMapsDemo project. In the BlackBerry Smartphone Simulator, click BlackBerry Maps Demo. Open the menu and click Invoke Location Document.
  • Page 17: Open Blackberry Maps To Display A Route Between Locations On A Map

    In the BlackBerry Smartphone Simulator, click BlackBerry Maps Demo. Open the menu and click Invoke Location Document. Open the menu and click View Multiple Locations. Open BlackBerry Maps to display a route between locations on a map Import the following classes: • net.rim.blackberry.api.invoke.Invoke •...
  • Page 18 ( MapsArguments.ARG_LOCATION_DOCUMENT,document)); View a sample application that displays a route between locations on a map From the BlackBerry® Integrated Development Environment, launch the BlackBerryMapsDemo project. In the BlackBerry Smartphone Simulator, click BlackBerry Maps Demo. Open the menu and click Invoke Location Document.
  • Page 19: Open Blackberry Maps To Display A Custom Map View

    A MapView object represents the view that the BlackBerry® Maps displays. The MapView object contains the latitude and longitude that the BlackBerry Maps uses as the center of the map and the zoom and rotation values for the map that it displays.
  • Page 20 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.
  • Page 21: Start A Blackberry Device Application From Blackberry Maps

    Start a BlackBerry device application from BlackBerry Maps You can add a menu item to BlackBerry® Maps that makes a MapView context object available based on the current location. When a BlackBerry device user selects the menu item, the MapView context object is passed to the menu item’s run() method.
  • Page 22 Development Guide Displaying location information on a BlackBerry device public String toString() return "Menu Item Demo"; * Code that executes when a BlackBerry smartphone user clicks the menu item. * @param context A MapView object. * @return null public Object run(Object context) if (context instanceof MapView ) _mv = (MapView)context;...
  • Page 23 Development Guide Displaying location information on a BlackBerry device // The ApplicationMenuItem invoked App . Call the default // constructor for the GUI version of the application and enter the application into the main event thread. MapsMenuItemDemo app = new MapsMenuItemDemo();...
  • Page 24 (latitude > 9000000 || latitude < -9000000 || longitude >= 18000000 || longitude < -18000000) throw new IllegalArgumentException (); _mapview.setLatitude(latitude); _mapview.setLongitude(longitude); // Invoke BlackBerry Maps with a MapView object. Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(_mapview)); close(); catch(RuntimeException re) // An exception is thrown when any of the following...
  • Page 25: Displaying Location Information In Your Application

    Displaying location information in your application A BlackBerry® device application can use the MapField class to display a map in a UI field. For a BlackBerry device application to use the MapField class, BlackBerry® Maps must be installed on the BlackBerry device and the BlackBerry device must be able to download data from the map server for location-based services.
  • Page 26: Converting Latitudinal And Longitudinal Coordinates To Pixel Values

    Converting latitudinal and longitudinal coordinates to pixel values You can create a BlackBerry® device application to convert latitudinal and longitudinal coordinates to pixel values. For latitude, north is a positive value, and south is a negative value. For longitude, east is a positive value and west is a negative value.
  • Page 27: Requesting Location Information For An Address

    XYPoint worldOut). Configure the display size of a MapField A BlackBerry® device application can control the display size of a MapField to make other UI components visible on the screen of a BlackBerry device. If you configure the preferred size of MapField, you override the dimension values passed in layout(). The height and width values are in pixels.
  • Page 28: Retrieve Location Information For An Address Stored In A String

    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...
  • Page 29: Clearing Data From The Map

    Clearing data from the map You can use the id and clear attributes of the <lbs> element to remove data from a map. When you want BlackBerry Maps to no longer display certain location data, 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 with the location data to remove.
  • Page 30: Clear Data From Specific Location Documents With An Id Attribute

    Development Guide Clearing data from the map You can only remove data from a location document that has an id attribute set to a value. Create a String that configures the clear attribute to Docs. String document = "<lbs clear='Docs' ><location lon='-7938675' lat='4367022' label='Toronto, ON' description='Toronto' zoom='10'/></lbs>";...
  • Page 31: Glossary

    Development Guide Glossary Glossary application programming interface Global Positioning System Java® Specification Request MIME Multipurpose Internet Mail Extensions NMEA National Marine Electronics Association Position Determination Entity Subscriber Identity Module World Geodetic System Extensible Markup Language...
  • Page 32: Provide Feedback

    Development Guide Provide feedback Provide feedback To provide feedback on this deliverable, visit www.blackberry.com/docsfeedback.
  • Page 33: Legal Notice

    Legal notice Legal notice ©2008 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.
  • Page 34 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.
  • Page 35 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.

This manual is also suitable for:

Gps and blackberry maps

Table of Contents