Open BlackBerry Maps by using a local search

You can open BlackBerry® Maps to display points of interest that are nearby the location that you specify in your search criteria. The search criteria is a String that must include a business category or a business name, and a location. For example, you can display all the hotels in the city of Waterloo.

A business category is a type of business, such as coffee, gas, hotels, pizza, and restaurants.

The location is a String that is the name of a village, town, or city, or the latitudinal and longitudinal coordinates, separated by a comma (for example, 4328915,-8032480). The coordinates must be the measurement in decimal degrees with five decimal accuracy multiplied by 100,000.

  1. Import the required classes.
    import net.rim.blackberry.api.invoke.*;
  2. Create a class and a constructor to use to invoke BlackBerry Maps.
    public class invokeMaps
    {
        public invokeMaps()
        {
        }
    }
  3. In the constructor, create an instance of the MapsArguments class. Pass in the MapsArguments.ARG_LOCAL_SEARCH and String objects to represent the search criteria. The following code sample searches for hotels in Waterloo.
    MapsArguments ma = new MapsArguments
        (MapsArguments.ARG_LOCAL_SEARCH, "hotels", "Waterloo");
  4. In the constructor, invoke Invoke.invokeApplication() to open BlackBerry Maps. Pass in the MapsArguments object.
    Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, ma);

Code sample: Opening BlackBerry Maps by using a local search

import net.rim.blackberry.api.invoke.*;

public class invokeMaps
{
    public invokeMaps()
    {
        MapsArguments ma = new MapsArguments
            (MapsArguments.ARG_LOCAL_SEARCH, "hotels", "Toronto");
        Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, ma);
    }
}

Was this information helpful? Send us your comments.