Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
amrinder_singh_003
Posts: 97
Registered: ‎09-21-2010
My Device: 8900
Accepted Solution

how to use the Google maps in Blackberry

Greetings 

 

 

Please help me in accessing the google maps in bb ,any samples or any code is there ,please help 

 

Regards

Amrinder Singh

Developer
jprofitt
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: how to use the Google maps in Blackberry

If you're trying to do anything fancy, the answer probably is you can't. I recall reading something a while ago about someone attempting to make a Google Maps SDK but haven't seen anything about it since. Regardless, I'd suggest taking a look at http://code.google.com/apis/maps/index.html

Regular Contributor
amrinder_singh_003
Posts: 97
Registered: ‎09-21-2010
My Device: 8900

Re: how to use the Google maps in Blackberry

greetings 

 

 

Means Google maps does not work in the Blackberry mobile .?

 

Please help in using the google maps if possible

 

 

Regards

Amrinder Singh

Regular Contributor
amrinder_singh_003
Posts: 97
Registered: ‎09-21-2010
My Device: 8900

Re: how to use the Google maps in Blackberry

 

package googleMaps;

class GMLocation {    
	 String mName;
	 String mDescription;
	 double mLatitude;
	 double mLongitude;
	 public GMLocation(double lat, double lon) {
	  mLatitude = lat;
	  mLongitude = lon;
	 }    
	 public GMLocation(double d, double e, String name) {
	  this(d, e);
	  mName = name;
	 }    
	 public GMLocation(double lat, double lon, String name, String descr) {
	  this(lat, lon, name);
	  mDescription = descr;
	 }    
	 public String getName() {
	  return mName;
	 }    
	 public String getDescription() {
	  return mDescription;
	 }    
	 public String getLongitude() {
	  return String.valueOf(mLongitude);
	 }    
	 public String getLatitude() {
	  return String.valueOf(mLatitude);
	 }
	}

 

 

 

package googleMaps;

import net.rim.blackberry.api.browser.URLEncodedPostData;
import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.system.ApplicationManagerException;
import net.rim.device.api.system.CodeModuleManager;
import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.ui.component.Menu;
import net.rim.device.api.ui.component.RichTextField;
import net.rim.device.api.ui.container.MainScreen;

class Scr extends MainScreen {
	 public Scr() {    
	 }    
	 protected void makeMenu(Menu menu, int instance) {
	  super.makeMenu(menu, instance);
	  menu.add(mInvokeGMaps);
	 }    
	 MenuItem mInvokeGMaps = new MenuItem("Run GMaps", 0, 0) {
	  public void run() {
		  
//		  GMLocation location 
//		    = new GMLocation(40.714728,-73.998672, "London");
	   GMLocation location 
	    = new GMLocation(51.507778, -0.128056, "London");
	   invokeGMaps(location);
	  };
	 };    
	 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());
	   }
	  }
	  RichTextField rich = new RichTextField("fhfdjdytdytd"+ mh);
	  add(rich);
	  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() };
	  RichTextField rich1 = new RichTextField("l.getName()"+ l.getName());
	  add(rich1);
	  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());
	  }
	 }
	}

 

Hi

 

i had used the two classes named as Scr and GMLocation.

 

Please help me in finding the problem ,y this is not connecting to the google maps .

Blank SCreen is coming to the MainScreen

 

and Google maps app is installed ,

 

Please help me.

 

regards 

AMrinder 

 

Regular Contributor
amrinder_singh_003
Posts: 97
Registered: ‎09-21-2010
My Device: 8900

Re: how to use the Google maps in Blackberry

Greetings 

 

 

The above code is perfect for calling the google map in blackberry application

 

we have to  do  the following:

1) First ,we need to install the google map in blackberry browser.make sure mds Command prompt of         bb is opened from research in motion(Program files).

     (In the blackberry Browse ,write m.google.com/map and then download)

 

2)  run the app ,and go to the Blackberry  simulate tab of simulator,then select GPS location in default             mode and then press play button .

 

3) Then go to the app ,press run Gmap  from  the menu item ,then the google maps is yours .

 

 

thanks & regards

Amrinder Singh

 

 

 

 

Developer
eraman
Posts: 34
Registered: ‎03-08-2012
My Device: Simulator

Re: how to use the Google maps in Blackberry

Thanks

                Amrinder Singh

This information is very usefull.

 

 

Keep posting new tips and tricks for blackberry.

 

 

thanks again.

Developer
huddarveena
Posts: 103
Registered: ‎12-12-2011
My Device: Developer

Re: how to use the Google maps in Blackberry

Hello Amrinder Singh, thanks for the tips about Google maps in BlackBerry. In the given code, when v launch d app, it takes the location that we specified i.e. London. How should we get the current location when we lauch the Google maps? Please provide an answer for this, thanks in advance.

Contributor
Amrit_Kumar
Posts: 10
Registered: ‎05-12-2012
My Device: 9860

Re: how to use the Google maps in Blackberry

[ Edited ]

Hi,

 

Your Code is working well, but it can display only one location.

But I want to show multiple location, then how can i achive it Plese help.

I have another option via javascript to display multiple markers but i dont want to use that.

 

 

Please help..

 

Thanks and regards 

Amrit.

 

Contributor
siddupatil
Posts: 23
Registered: ‎03-17-2014
My Device: 9220

Re: how to use the Google maps in Blackberry

Hey Amrit,

Did you get anything on planting multiple points in google map??? or kindly brief me what about the other option using JaveScript.
Developer
rakesh86shankar
Posts: 1,005
Registered: ‎05-22-2009
My Device: Not Specified

Re: how to use the Google maps in Blackberry