Question

This is a question-loaded post from someone who is just getting started with BB development. Any guidance is much appreciated.

How are map based BlackBerry apps such as Yelp and Google Map implemented? As with the web based version. Yelp for the BB allows you to search for restaurants & etc. based on on the current or specified location. The search result is in a form of a list or a map view displaying markers of the search results. Yelp's map is powered by Bing. How is the map, along with the markers, invoked within the BB code? For the list view, what is being used to retrieve the list of results from the database. Can any database be used?

Google Map 3.2 for the BB now supports layers. Again, how are the Google maps invoked? You can also select a marker (i.e. Wiki, gas station) of a particular location directly on the map and view the information of that location (i.e. Wiki, gas station address). How is this being done?

My knowledge in map technology as well as BB development is very limited, so basic or in depth feedback are both welcomed.

Was it helpful?

Solution

I have no experience of writing real-world gps applications for blackberry, below are just my observations and thoughts about possible workarounds.

Blackberry Yelp Application

Indeed, Blackberry Yelp application show map if you do search and then go into result and see Map Adress

alt text http://img197.imageshack.us/img197/965/13428830.jpgalt text http://img269.imageshack.us/img269/1976/92068364.jpg

See also Yelp Launches Bing-Powered Blackberry App

If you look into Yelp API you will find only search functionality which may optionally use Google Maps to display search result location on your website.

Bing seems to be MS analogue for Google Maps. And there is an ASP Bing Map Control which hardly can be used in BB development.

Blackberry Google Maps Application

alt text http://img193.imageshack.us/img193/9678/39917026.jpg

You can invoke installed Google Maps Mobile from code:

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

Using custom location class:

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

See also How to use Google Map in Blackberry application?

Conclusion

Blackberry browser and BrowserField has a limited support of JavaScript. Since both Bing and GMaps are based on JavaScript, my suspicion is that they use static images retrieved from server to display map control. This may be possible but that means server side implementation and all required API developer keys.

As an alternative, you can invoke installed GMaps from code on Blackberry.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top