BlackBerry 和基于地图的应用程序,例如 Yelp 和 Google Map [英] BlackBerry and map based apps like Yelp and Google Map

查看:15
本文介绍了BlackBerry 和基于地图的应用程序,例如 Yelp 和 Google Map的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个刚开始 BB 开发的人的问题加载帖子.非常感谢任何指导.

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

如何实现基于地图的黑莓应用程序,例如 Yelp 和 Google Map?与基于 Web 的版本一样.BB 的 Yelp 允许您搜索餐厅和等基于当前或指定的位置.搜索结果以列表或地图视图的形式显示搜索结果的标记.Yelp 的地图由 Bing 提供支持.如何在 BB 代码中调用地图以及标记?对于列表视图,用于从数据库中检索结果列表的内容.可以使用任何数据库吗?

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?

用于 BB 的 Google Map 3.2 现在支持图层.同样,如何调用 Google 地图?您还可以直接在地图上选择特定位置的标记(即 Wiki、加油站)并查看该位置的信息(即 Wiki、加油站地址).这是怎么做的?

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?

我在地图技术和BB开发方面的知识非常有限,因此欢迎提供基本或深入的反馈.

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

推荐答案

我没有为黑莓编写真实世界的 gps 应用程序的经验,以下只是我对可能的解决方法的观察和想法.

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

确实,如果您进行搜索,Blackberry Yelp 应用程序会显示地图,然后进入结果并查看地图地址

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

替代文字 http://img197.imageshack.us/img197/965/13428830.jpg替代文字 http://img269.imageshack.us/img269/1976/92068364.jpg

另请参阅 Yelp 推出 Bing-支持黑莓应用程序

如果您查看 Yelp API,您会发现只有搜索功能可能 可选择使用谷歌地图来显示搜索结果位置在您的网站上.

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 似乎是 Google 地图的 MS 模拟.还有一个 ASP Bing Map Control 几乎不能用于BB开发.

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.

替代文字 http://img193.imageshack.us/img193/9678/39917026.jpg

您可以从代码中调用已安装的 Google Maps Mobile:

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

使用自定义位置类:

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

另请参阅如何在黑莓应用程序中使用谷歌地图?

黑莓浏览器和 BrowserField 对 JavaScript 的支持有限.由于 Bing 和 GMaps 都基于 JavaScript,我怀疑它们使用从服务器检索的静态图像来显示地图控件.这可能是可能的,但这意味着服务器端实现和所有必需的 API 开发人员密钥.

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.

作为替代方案,您可以从 Blackberry 上的代码调用已安装的 GMap.

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

这篇关于BlackBerry 和基于地图的应用程序,例如 Yelp 和 Google Map的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆