谷歌地图与黑莓集成

时间:2012-05-04 07:09:35

标签: google-maps blackberry map

我想在我的黑莓原生应用程序中集成G​​oogle地图。我的要求是:

  1. 搜索最近的位置
  2. 在地图上固定位置
  3. 点击任何图钉,会显示一个小弹出窗口,用户可以查看详细信息 说明
  4. 显示地址的工具提示应该是交互式的。
  5. 类似于附加图像的东西。引导我用样品来实现它。

    enter image description here

1 个答案:

答案 0 :(得分:0)

您可以使用GMLocation位置示例

GMLocation location = new GMLocation(51.507778, -0.128056, "London");
invokeGMaps(location);

invokeGMaps方法

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

GMLocation类

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

}