【问题标题】:Google map integration with blackberry谷歌地图与黑莓的集成
【发布时间】:2012-05-04 15:33:19
【问题描述】:

我想在我的黑莓本机应用程序中集成 Google 地图。我的要求是:

  1. 搜索最近的位置
  2. 在地图上标出位置
  3. 点击任何引脚,将显示一个小弹出窗口,用户可以在其中查看详细信息 说明
  4. 显示地址的工具提示应该是交互式的。

类似于附加图片的东西。用示例指导我实现它。

【问题讨论】:

    标签: google-maps blackberry map


    【解决方案1】:

    您可以使用GMLocation位置示例

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

    调用GMaps方法

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

    }

    【讨论】:

    • 感谢您的快速回复。使用这种方法会调用谷歌地图应用程序。还有其他方法可以将相同的内容集成到我的应用程序中,而不是依赖于其他应用程序吗?
    • 我认为您可以在 brouserfield 中使用谷歌地图网址。 developers.google.com/maps/documentation/staticmaps/…此链接用于此
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多