net.rim.device.api.lbs
Class Locator

java.lang.Object
  extended by net.rim.device.api.lbs.Locator

Deprecated. Use the Geocoder or ReverseGeocoder classes.

public final class Locator
extends Object

Locator is a geocoding service that allows you to obtain location information for an address. You can use the Locator class to obtain latitudinal and longitudinal information using either an AddressInfo object for formatted input or a String object for non-formatted input. A successful request for geocode information return an enumeration of Landmark objects.

Requests for geocode information are synchronous, but can be interrupted by invoking Locator.cancel(). An application can use the Locator class to make only one request at a time. Making more than one request results in a MapServiceException.

An application must request geocode information outside of the event dispatch thread. Requests made on the event dispatch thread will be denied and result in a MapServiceException.

Each request for geocode information is sent to the LBS Locator Server. If a request fails, a LocatorException is thrown with an error code that indicates the reason for the failure.

If the LBS Map API module is not installed on the BlackBerry device, requests for geocode information will throw a MapServiceException.

Request results are not cached on the BlackBerry device.

Usage Scenario

Freeform String geocode request

Returns to landmarkArray an array of Landmark objects that fit the “Waterloo” search criteria.

Landmark[] landmarkArray = Locator.geocode(“Waterloo”, null);

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:
BlackBerry API 4.6.0

Field Summary
Category: Signed static int ADDRESS
          Deprecated.  
Category: Signed static int CITY
          Deprecated.  
Category: Signed static int COUNTRY
          Deprecated.  
Category: Signed static int POSTAL_ZIP_CODE
          Deprecated.  
Category: Signed static int PROVINCE_STATE
          Deprecated.  
Category: Signed static int REQUEST_TIMEOUT
          Deprecated.  
 
Method Summary
Category: Signed static void cancel()
          Deprecated. Note: The method does nothing in this release, just for backward compatible. It was improperly implemented in previous release
Category: Signed static Landmark[] geocode(String freeformString, Coordinates startCoords)
          Deprecated. Use Geocoder.geocode()
Category: Signed static Landmark[] geocode(AddressInfo address, Coordinates startCoords)
          Deprecated. Use Geocoder.geocode()
Category: Signed static Landmark[] reverseGeocode(int latitude, int longitude, int searchType)
          Deprecated. Use ReverseGeocoder.reverseGeocode()
Category: Signed static Landmark[] reverseGeocode(Coordinates coord, int searchType)
          Deprecated. Use ReverseGeocoder.reverseGeocode()
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

REQUEST_TIMEOUT

public static final int REQUEST_TIMEOUT
Deprecated. 
This constant is deprecated and should not be relied upon.

See Also:
Constant Field Values
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:
BlackBerry API 4.6.0

ADDRESS

public static final int ADDRESS
Deprecated. 
Use this to request the nearest address or nearest street to the specified latitude/longitude.

If the nearest address cannot be found, the nearest administrative region is returned. This could be a combination of city, state/province and/or country depending on if the location is inside one of these boundaries.

See Also:
Constant Field Values
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:
BlackBerry API 5.0.0

COUNTRY

public static final int COUNTRY
Deprecated. 
Use this constant for reverse geocoding so that the return value focuses on the country level. This returns the name of the country.

See Also:
Constant Field Values
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:
BlackBerry API 5.0.0

PROVINCE_STATE

public static final int PROVINCE_STATE
Deprecated. 
Use this constant for reverse geocoding so that the return value focuses on the province/state level. This returns the name of the province/state and country.

See Also:
Constant Field Values
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:
BlackBerry API 5.0.0

CITY

public static final int CITY
Deprecated. 
Use this constant for reverse geocoding so that the return value focuses on the city level. This returns the name of the city, province/state and country.

See Also:
Constant Field Values
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:
BlackBerry API 5.0.0

POSTAL_ZIP_CODE

public static final int POSTAL_ZIP_CODE
Deprecated. 
Use this to reverse geocode a latitude/longitude to a postal/zip code. This returns the postal/zip code, province/state and country.

See Also:
Constant Field Values
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:
BlackBerry API 6.0.0


Method Detail

geocode

public static Landmark[] geocode(AddressInfo address,
                                 Coordinates startCoords)
                          throws LocatorException
Deprecated. Use Geocoder.geocode()

Starts a request for geocode information using an AddressInfo object as input.

Parameters:
address - The AddressInfo object to use for requesting geocoding information. Supported fields include: STREET, POSTAL_CODE, CITY, STATE, COUNTRY or COUNTRY_CODE.
startCoords - The Coordinates for starting the search specified in the request. This is used to refine a request from an initial location starting point. This parameter may be null.
Returns:
An array of Landmarks. The first array element contains the most relevant Landmark to the locator request.
Throws:
LocatorException - if the request could not be fulfilled. To obtain the reason the request is not fulfilled, invoke LocatorException.getErrorCode().
MapServiceException - if the LBS Map API is not installed on the BlackBerry device or if an application makes more than one request at a time.
IllegalThreadStateException - if a request is made on the event dispatch thread.
IllegalStateException - thrown if there is no valid connectivity to send the request upon.
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:
BlackBerry API 5.0.0

geocode

public static Landmark[] geocode(String freeformString,
                                 Coordinates startCoords)
                          throws LocatorException
Deprecated. Use Geocoder.geocode()

Starts a request for geocode information using a non-formatted String as input.
For example: 'Paris', '10 Downing St London UK', '90210 USA' are valid search requests.

Parameters:
freeformString - The search String used as input to request geocode information.
startCoords - The Coordinates for starting the search specified in a request. This request uses this data to refine the starting point. This parameter can be null.
Returns:
An array of Landmarks. The first array element contains the most relevant Landmark to the locator request.
Throws:
LocatorException - if the request could not be fulfilled. To obtain the reason the request is not fulfilled, invoke LocatorException.getErrorCode().

MapServiceException - if the LBS Map API is not installed on a BlackBerry device or if an application makes more than one request at a time.
IllegalThreadStateException - if a request is made on the event dispatch thread.
IllegalStateException - thrown if there is no valid radio/wi-fi connection to send the request to.
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:
BlackBerry API 4.6.0

reverseGeocode

public static Landmark[] reverseGeocode(Coordinates coord,
                                        int searchType)
                                 throws LocatorException
Deprecated. Use ReverseGeocoder.reverseGeocode()

Starts a request for reverse geocoding using a Coordinates object. The reverse geocoding request blocks until it completes, cancels, or times out.

Parameters:
coord - A Coordinates object that contains at least the latitude and longitude.
searchType - The type of the search to perform, which can be one of the following: ADDRESS, COUNTRY, PROVINCE_STATE, POSTAL_CODE, or CITY.
Returns:
An array of Landmarks.
Throws:
LocatorException - if the request could not be fulfilled. To obtain the reason the request is not fulfilled, invoke LocatorException.getErrorCode().
IllegalThreadStateException - if a request is made on the event dispatch thread.
IllegalStateException - thrown if there is no valid radio/wi-fi connection to send the request to.
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:
BlackBerry API 5.0.0

reverseGeocode

public static Landmark[] reverseGeocode(int latitude,
                                        int longitude,
                                        int searchType)
                                 throws LocatorException
Deprecated. Use ReverseGeocoder.reverseGeocode()

Starts a request for reverse geocoding using the latitude, longitude, and search type. The reverse geocoding request blocks until it completes, cancels, or times out.

Parameters:
latitude - The latitude of the address, specified as decimal degrees to five decimal places, multiplied by 100000.
longitude - The longitude of the address, specified as decimal degrees to five decimal places, multiplied by 100000.
searchType - The type of the search to perform, which can be one of the following: ADDRESS, COUNTRY, PROVINCE_STATE, POSTAL_CODE, or CITY.
Returns:
An array of Landmarks.
Throws:
LocatorException - If the request could not be fulfilled. To obtain the reason the request is not fulfilled, invoke LocatorException.getErrorCode().
IllegalThreadStateException - if a request is made on the event dispatch thread.
IllegalStateException - thrown if there is no valid radio/wi-fi connection to send the request to.
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:
BlackBerry API 5.0.0

cancel

public static void cancel()
Deprecated. Note: The method does nothing in this release, just for backward compatible. It was improperly implemented in previous release

Cancels the Locator request for the calling application process.

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:
BlackBerry API 4.6.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal