SHOW Signed
 

net.rim.blackberry.api.invoke
Class MapsArguments

java.lang.Object
  |
  +--net.rim.blackberry.api.invoke.ApplicationArguments
        |
        +--net.rim.blackberry.api.invoke.MapsArguments

public final class MapsArguments
extends ApplicationArguments

Encapsulates arguments to pass to the BlackBerry Maps application.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

Since:
JDE 4.2.0

Field Summary
 Category: Signed static String ARG_LOCATION_DOCUMENT
          Argument to open Maps and display points using the provided location document
   
Constructor Summary
 Category: Signed MapsArguments()
          Creates a new MapsArguments instance with default arguments.
 Category: Signed MapsArguments(Contact contact, int addressIndex)
          Creates a new MapsArguments instance with provided arguments
 Category: Signed MapsArguments(MapView mapView)
          Creates a new MapsArguments instance with a specified view.
 Category: Signed MapsArguments(String arg, String locationDocument)
          Creates a new MapsArguments instance with provided arguments.
 
Method Summary
 
Methods inherited from class net.rim.blackberry.api.invoke.ApplicationArguments
getArgs
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARG_LOCATION_DOCUMENT

public static final String ARG_LOCATION_DOCUMENT
Argument to open Maps and display points using the provided location document
Since:
JDE 4.2.0
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Constructor Detail

MapsArguments

public MapsArguments()
Creates a new MapsArguments instance with default arguments.

The default arguments instruct Maps to open in the default view or last lat/long.

Since:
JDE 4.2.0
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

MapsArguments

public MapsArguments(Contact contact,
                     int addressIndex)
Creates a new MapsArguments instance with provided arguments
Parameters:
contact - A contact with at least one address. The Maps application will start and attempt to search for one of the addresses for the contact. If the contact has no addresses, when invoked with this MapsArgument the Maps application will open to the default location.
addressIndex - The index (beginning at 0) of the address you would like displayed. If the index is invalid, when invoked with this MapsArgument the Maps application will open to the default location.
Since:
JDE 4.2.1
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

MapsArguments

public MapsArguments(MapView mapView)
Creates a new MapsArguments instance with a specified view. If the mapView parameter is null, the Maps application starts in the default state. Note: the rotation specified in the view is currently ignored.
Parameters:
mapView - The view used to display the map
Since:
JDE 4.2.1
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

MapsArguments

public MapsArguments(String arg,
                     String locationDocument)
Creates a new MapsArguments instance with provided arguments. See the BlackBerry Java Development Environment Development Guide for more information about BlackBerry Maps and the location document.

In the application code, you must multiply the latitudinal and longitudinal values used by the javax.microedition.locationCoordinates class by 100,000.

In the following examples, the internal GPS of a BlackBerry device returns values of 45.000 and -75.000 for the longitude and latitude of a location. After multiplying each value by 100,000 your application code sends 4,500,000 and -7,500,000 to the location document. BlackBerry maps interprets and displays these values as 45 degrees longitude and -75 degrees latitude respectively.

Example 1: Invoke BlackBerry Maps to display a single location:
String location = "<lbs>" + "<location lat='-7500000' lon='4500000'/>" + "</lbs>";

Example 2: Invoke BlackBerry Maps to display multiple points of interest:
String location = "<lbs>"
+ " <location lat='-7500000' lon='4500000' label='TestPoint1' description='This could have a phone number. 555-1212'/>"
+ " <location lat='-7500000' lon='4500100' label='TestPoint2' description='This could have a phone number. 555-1212'/>"
+ " <location lat='-7500000' lon='4500200' label='TestPoint3' description='This could have a phone number. 555-1212'/>"
+ "</lbs>";

Example 3: Invoke BlackBerry Maps to display a route:
String route = "<lbs>" + "<getRoute>"
+ "<location lat='-7569792' lon='4542349' address='Ottawa, ON, CANADA'/>"
+ "<location lat='-7938675' lon='4367022' address='Toronto, ON, CANADA'/>"
+ "</getRoute>" + "</lbs>";

Example 4: Invoke BlackBerry Maps to display a contact's placement: Call Invoke.invokeApplication(int appType, ApplicationArguments args) using the Invoke.APP_TYPE_MAPS constant parameter and a new MapsArguments object created using the contact object.
Contact c = null;
try {
ContactList cl = (ContactList)PIM.getInstance().openPIMList( PIM.CONTACT_LIST, PIM.READ_ONLY );
Enumeration e = cl.items();
c = (Contact)e.nextElement();
} catch (Exception e) {}
Invoke.invokeApplication( Invoke.APP_TYPE_MAPS, new MapsArguments( c, 0 ) );

See the BlackBerry Java Development Environment Developer Guide for more information about working with BlackBerry Maps and map arguments.

Parameters:
arg - Specify ARG_LOCATION_DOCUMENT to open BlackBerry Maps to display the points of interest in the location document. The lat and lon parameters represent longitude and latitude respectively.
locationDocument - A string that contains location data.
Since:
JDE 4.2.0
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.