Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Open BlackBerry Maps with 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.

Import the required classes.

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

Create a class and a constructor to use to invoke BlackBerry Maps.

public class invokeMaps
{
    public invokeMaps()
    {
    }
}

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");

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 with 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);
    }
}