Search code examples
javagoogle-mapsblackberryblackberry-stormblackberry-maps

google map with route in blackberry


how to use google map with route in blackberry . i tried blackberry map with route but in my device (Storm 2) cant display map . i dont know what is the issue ?

any one have idea ragarding google map in blackberry application than let me know.

i tried this http://maps.google.com/maps?saddr=23.4444,72.44445&daddr=23.55555,72.55555 and open this url in BB browser but it cant redirect to map site .

how can we handle google map or blackberry map with route in BB application ?


Solution

  • i have implemented Google Map with route in Blackberry via Google Map Installed App.

       public void invokeGoogleMap() { 
         int mh = CodeModuleManager.getModuleHandle("GoogleMaps");
         if (mh == 0) 
         {
              try 
              {
                throw new ApplicationManagerException("GoogleMaps isn't installed");
              } 
              catch (ApplicationManagerException e) 
              {
                System.out.println(e.getMessage());
              }
              UiApplication.getUiApplication().invokeLater(new Runnable() {
                public void run() {
                  stubDialog.inform("GoogleMaps isn't installed on your device.download it from m.google.com/maps.");
                }
              });
         }
         else
         {
             URLEncodedPostData uepd = new URLEncodedPostData(null, false);
             uepd.append("action", "ROUT"); // or LOCN
             uepd.append("start", "23.039568,72.566005");
             uepd.append("end", "23.02,73.07");
             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());
             }
    
         }
      }