How to install google maps in blackberry

267 Views Asked by At

I am trying to access google maps from my application. My code is as below:

  public void invokeGMaps(GMLocation l) {
    int mh = CodeModuleManager.getModuleHandle("GoogleMaps");
    if (mh == 0) {
        try {
            throw new ApplicationManagerException("GoogleMaps isn't installed");
        }
        catch (ApplicationManagerException e) {
            System.out.println(e.getMessage());
        }
    }
    URLEncodedPostData uepd = new URLEncodedPostData(null, false);
    uepd.append("action", "LOCN");
    uepd.append("a", "@latlon:" + l.getLatitude() + "," + l.getLongitude());
    uepd.append("title", l.getName());
    uepd.append("description", l.getDescription());
    String[] args = { "http://gmm/x?" + uepd.toString() };
    ApplicationDescriptor ad = CodeModuleManager.getApplicationDescriptors(mh)[0];
    ApplicationDescriptor ad2 = new ApplicationDescriptor(ad, args);
    try {
        ApplicationManager.getApplicationManager().runApplication(ad2, true);
    }
    catch (ApplicationManagerException e) {
        System.out.println(e.getMessage());
    }
}

I get null pointer exception when I try to launch the maps and this is because I have not yet installed google maps. How do I install the maps for my application to run?Where do I have to install the maps? I visited the link "m.google.com/maps" but I do not understand or see where to install the maps?Are the maps to be installed on every handset my application will be running?Please guide. I am totally lost.

0

There are 0 best solutions below